Android compiling help

Previous topic - Next topic

erico

Being as dumb as a door, I can´t seem to figure out how to compile for Android.
I need it to auto generate the APK as I could not do it manually so far and after uninstalling all java and putting it back again on what the GLB compiler recommended (ye 32 bit and so on) I still get this message:

Quote
_______________________________________
*** Configuration: ANDROID ***
precompiling:
GPC - GLBasic Precompiler V.10.160 SN:37233beb - 3D, NET
Wordcount:2137 commands
compile+link:
running Android build-script...
BUILD STAGE 1: Compile and pack RELEASE
Updated and renamed default.properties to project.properties
Updated local.properties
Added file C:\Users\JAC\Desktop\FUED\TREEHOUSE\TH - AVOCADO MAYHEM\distribute\Android\build.xml
Updated file C:\Users\JAC\Desktop\FUED\TREEHOUSE\TH - AVOCADO MAYHEM\distribute\Android\proguard.cfg
Unable to locate tools.jar. Expected to find it in C:\program Files (x86)\Java\lib\tools.jar
     [echo] Gathering info for glbasic...
     [echo] Creating output directories if needed...
     [echo] ----------
     [echo] Handling aidl files...
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...

BUILD FAILED
Q:\Compiler\platform\android\android-sdk-windows\tools\ant\build.xml:580: The following error occurred while executing this line:
Q:\Compiler\platform\android\android-sdk-windows\tools\ant\build.xml:602: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\program Files (x86)\Java"

Total time: 1 second
.
BUILD STAGE 2: Build DEBUG and install on device
Unable to locate tools.jar. Expected to find it in C:\program Files (x86)\Java\lib\tools.jar
     [echo] Gathering info for glbasic...
     [echo] Creating output directories if needed...
     [echo] ----------
     [echo] Handling aidl files...
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...

BUILD FAILED
Q:\Compiler\platform\android\android-sdk-windows\tools\ant\build.xml:580: The following error occurred while executing this line:
Q:\Compiler\platform\android\android-sdk-windows\tools\ant\build.xml:602: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\program Files (x86)\Java"

Total time: 1 second
finished Android build-script.
Android=C:\Users\JAC\Desktop\FUED\TREEHOUSE\TH - AVOCADO MAYHEM\distribute\Android
success
_______________________________________
*** Finished ***
Elapsed: 15.0 sec. Time: 22:18
Build: 1 succeeded.

Why is it soooo hard! :'(
Caanoo compiling is so much easier, I wonder it is the same on easyness on webos.

Anyway, I do have some bookmarked forum topics on android, but if anyone can help me out with these or share more topics I could research, would be really nice!

EDIT: not to count the multiple re-starts on my machine as system variables are something strange to me...I hate to turn off my computer :(

erico

#1
maybe the tools.jar is on the JDK...

let´s see, I got jdk-7u17-windows-i586

let me see if this works out...heck I´m sure I did download that before :blink:

EDIT: and I did, but I found that as com-sun-tools-visualvm-tools.jar on some other folder...copied and renamed it...now I get different errors looking for some other stuff.

erico

#2
Reinstalled java again as Mentalthink recommended...it seems to work but I guess the problem is my device now.

Good Lord! What a relief!

This is what I get now:
Quote_______________________________________
*** Configuration: ANDROID ***
precompiling:
GPC - GLBasic Precompiler V.9.829 SN:37233beb - 3D, NET
Wordcount:2137 commands
compile+link:
running Android build-script...
BUILD STAGE 1: Compile and pack
     [echo] Creating output directories if needed...
     [echo] Compiling aidl files into Java classes...
     [echo] Compiling RenderScript files into Java classes and RenderScript bytecode...
     [echo] Generating R.java / Manifest.java from the resources...
     [echo] Converting compiled files and external libraries into C:\Users\JAC\Desktop\FUED\TREEHOUSE\TH - AVOCADO MAYHEM\distribute\Android\bin\classes.dex...
     [echo] Packaging resources
     [echo] No key.store and key.alias properties found in build.properties.
     [echo] Please sign C:\Users\JAC\Desktop\FUED\TREEHOUSE\TH - AVOCADO MAYHEM\distribute\Android\bin\glbasic-unsigned.apk manually
     [echo] and run zipalign from the Android SDK tools.

BUILD SUCCESSFUL
Total time: 3 seconds
BUILD STAGE 2: Install on device
     [echo] Creating output directories if needed...
     [echo] Compiling aidl files into Java classes...
     [echo] Compiling RenderScript files into Java classes and RenderScript bytecode...
     [echo] Generating R.java / Manifest.java from the resources...
     [echo] Converting compiled files and external libraries into C:\Users\JAC\Desktop\FUED\TREEHOUSE\TH - AVOCADO MAYHEM\distribute\Android\bin\classes.dex...
     [echo] Packaging resources
     [echo] Running zip align on final apk...
     [echo] Debug Package: C:\Users\JAC\Desktop\FUED\TREEHOUSE\TH - AVOCADO MAYHEM\distribute\Android\bin\glbasic-debug.apk
     [echo] Installing C:\Users\JAC\Desktop\FUED\TREEHOUSE\TH - AVOCADO MAYHEM\distribute\Android\bin\glbasic-debug.apk onto default emulator or device...

BUILD FAILED
Q:\Compiler\platform\android\android-sdk-windows\tools\ant\main_rules.xml:641: The following error occurred while executing this line:
Q:\Compiler\platform\android\android-sdk-windows\tools\ant\main_rules.xml:271: exec returned: 1

Total time: 9 seconds
finished Android build-script.
Android=C:\Users\JAC\Desktop\FUED\TREEHOUSE\TH - AVOCADO MAYHEM\distribute\Android
success
_______________________________________
*** Finished ***
Elapsed: 19.3 sec. Time: 23:51
Build: 1 succeeded.


So hopefully the standards are doing fine.

EDIT: and now it works...not out of the box, but I can move the apk to the phone and run it. It only produces sounds as screen type and everything else is not quite the standard way of deploying to an android phone, ye screeen size and all...but I can hear the sounds, wonder if the accelerometer will work the same way from caanoo to android :)

spacefractal

Installing trought upd is a worst piece of crap ever. It's unstable and fail around 70% of times here on all my devices too, even on my new tab2 tablet.

So we need some sort of progressbar, so we can se If its doing sometimes or not.

So That why I'm use a APK installer, when its fail. It's often faster to do.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

erico

#4
Is UDP what glb is using to deploy straight to phone?

I´m currently just copying glbasic-debug.apk to it.
I get the sounds but only a white screen so far.
Program seems to be running...

edit: I think grabsprite is not quite working there and plots a white image...after messing around a bit, I can see the original 320x240 behind it running ok.
I will try createscreen then... but how am I suppose to rotate it?

spacefractal

Yes, but very unstable here. Here om not sure Gernot can do anything with it, other doing a APK installer on the device when the app is started up... A low priority here, or possible glbasic could copy the APK to a folder after own choice (which here works fine).
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

dreamerman

So currently app isn't automatically installed on your device?
Despite that I read some time ago that jdk6 is recommended to use - due some signing problems - I don't know current status of that issue so next thing:

1. Does your device is recognized by Google adb debugger? after pluging in, it should be visible on device list, to check it:
run cmd, navigate to your 'android-sdk\platform-tools' folder, type:
Code (glbasic) Select
adb devices
If you device doesn't have correct USB drivers for debug mode then it wont be visible. Probably most cheap Chinese based tablets (as mine :D) have such problem, so in that case you need to add it manually to debugger files.

Plug your android device to usb - don't select usb connection type on device, run system 'device manager' / Control Panel - System - Dev mgr, navigate to device entry - at this stage it can be unrecognized and visible as some mysterious txt, go to it properties - details, from combo choose  'device identy/description' or similar there should be string similar to this:
Code (glbasic) Select
USB\VID_2207&PID_0010&REV_0222&MI_01 it can have different numbers of course.. copy it..
Go to 'android-sdk\extras\google\usb_driver', edit 'android_winusb.inf', in sections '[Google.NTx86]' and '[Google.NTamd64]' add two lines for your device:
Code (glbasic) Select
%SingleAdbInterface% = USB_Install, copied_info_string_without_last_&
%CompositeAdbInterface%= USB_Install, copied_info_string

next go to: 'C:\Users\your_user\.android', edit 'adb_usb.ini', add first value from id string, for my device it would be: 0x2207
restart adb debugger, reconnect your device, now it should be recognized as 'google .. adb driver' or something like this, and should be visible on adb devices list..

2. have you enabled debug mode on device? -> settings - system - programming options - enable debug mode

For me auto installing apps by glBasic is stable, always installed correctly, no problems.
And you can see debugger output with this file: 'GLBasic\Compiler\platform\android\bin' -> '_Logview.bat', but edit it and check paths - they need to be correct, to print debug info on android use 'stdout' in glBasic...
Check my source code editor for GLBasic - link Update: 20.04.2020

erico

#7
Hi Dreamerman,

first time I ran ADB DEVICES is said:
QuoteC:\Program Files (x86)\Android_sdk\sdk\platform-tools> adb devices
adb server is out of date.  killing...
* daemon started successfully *
List of devices attached

Later running it again, it says ´LIST OF DEVICES ATTACHED´ and nothing more, no device.

I´m using jdk1.7.0_17 and jre7.

One thing is that windows detects it ok, names it and so on.
It is a samsung galaxy note II (n7100). Should work?... and costed a fortune :O (to my parents as it was a gift ;/).

I will take a closer look at your recommendation on fixing that, but do you think it is better to use Jdk6?

On another monstruous matter, my display routines were quite the cheap ones with grabsprite and so on, which seems not to be working.
I did a quick fix with create screen and loaded the background as sprite instead of loadbmp (ye backbuffer stuff).

I set final and project resolutions to 1280x720, which is the phone one in landscape mode, which is how I would like to have it running.
So now I managed to have it running, as the attached picture.

It seems the getjoyx(1) , used as accelerometer on caanoo, does not work on it at all.

But there are good sides and improvements  :) It is now working, I just have to code in some touch control I guess, sound is going fine too as fps is fine at 60.

I think I´m in for trouble supporting other resolutions on android, my drawing routine is a mess...the thrills of developing without the hardware in hand first :P

Thanks for the help!

erico

#8
quick self reply.. :P

getjoyx(0) works fine for android accelerometer. EDIT: it is just a different sensibility, way more sensible...

dreamerman

Erico, don't forget about second part - enable debug mode on phone.
I think that such device should have good usb debug drivers, maybe they are on cd or can be downloaded from net..
The method that I posted can be used for any kind of android based device and it's recommended on many forums - mostly in terms of rooting device - but this part is only how to make your device visible on debugger list, so does not interfere in phone, and take only a little time ;-)
About jdk version.. after successfully deployment of your app, you must sign it to publish it on market, there were some issues with that in jdk7 and normal glBasic version, so I installed jdk6, and don't know does it works now. :-)
Check my source code editor for GLBasic - link Update: 20.04.2020

mentalthink

Yuhuuu!!! Working finally...  :good: :good: , really when Android works it's the better platform for compile only press the button and runs, very confordable...

erico

Hi guys, thanks for all the help! :good:

Quote from: dreamerman on 2013-Mar-15
Erico, don't forget about second part - enable debug mode on phone.

Ok, phone is running on debug mode, and this phone has a nice list of features and configs on the debug side, really nice.
About the device being listed. I will go about that method, as GLB currently does not deploy to the phone here, I have to copy the debug.apk file manually over usb.
I will see the jdk6/7 thing before I go about that method.

Quote from: dreamerman on 2013-Mar-15
About jdk version.. after successfully deployment of your app, you must sign it to publish it on market, there were some issues with that in jdk7 and normal glBasic version, so I installed jdk6, and don't know does it works now. :-)

I´m not sure either, but I think I will install the version 6 just to be on the sure side.
I foresee I´m going to have trouble signing the app, since I don´t know much about this all and am trying to fast learn.

Quote from: mentalthink on 2013-Mar-15
Yuhuuu!!! Working finally...  :good: :good: , really when Android works it's the better platform for compile only press the button and runs, very confordable...

Hehe, it is an improvement! Not as simple as compiling to the Caanoo, but I´m enjoying it. :good:

Overall there are a few issues to resolve yet:
-signing the app
-screen sizes
-touch control

...and a few others as well as doing frontend, endings and music for the game.
I think I better resolve the android issues before I get back on the game itself.

But I´m quite happy it is working out.
And that thanks for the help I´m getting from you guys and other posts on the forum.

I really should have bookmarked all the interesting stuff I read on android around here...quite hard to find some of them through the search engine.
I think the search engine does not like me too much! ::)

Super Thanks Again!

erico

#12
Damn weird android phones and their java thing...

I did a quick routine to check mouse so you control players left and right by touching. Works fine on mouse on pc, works strange on the phone, like I have to have one touch going and the second touch is the one that counts to activate it...really weird!

Of course my coding sucks bad on it too, I have to investigate further, would be nice to have fixed controls, one analog joy (left-right) on the right/lower part of the screen and a button on the left.

The bad design is that on keyboard, it can be played single handed, so I want to offer a possible single hand control to android too.
Gsensor can do, but this is really not the kind of game to play this way, will keep this system anyways. 

dreamerman

Touch input is little different from mouse.. on my device with screen that has 5 multitouch, with GetMouseCount I always get 5, MouseState for all touch inputs returns some position on the screen, but if user isn't currently touching screen left button has state 0, if he touches but state is 1. You have to take this into consideration, when creating input functions.
Check my source code editor for GLBasic - link Update: 20.04.2020

erico

#14
Touch is working fine now! Thanks Dreamerman. It ended up I coded things a bit wrong, I guess I must take some time off to cool my mind. Did a bit today.

While test touching screen on the sides worked, I sure want to create a kind of analog joy/slider on the left lower part, and the jump button on the right.
I foresee troubles on scaling it to different resolutions for different androids.

While compiling a pure 320x240 for android does work, the phone does not scale fullscreen automatically. It seems the coordinates for touch/mouse come from the setup on the project options tab.

In a worst case scenario, I can compile different version for different resolutions. It should be fine with the stores I guess.

I also found out the sound gets strange similar to the caanoo, but not on pc.
But that is my fault, I´m calling the same sound multiple times(walking sounds) without giving it time to finish.
A timer based on the player fixed anim and sound length should handle it for both platforms :)