GLBasic forum

Main forum => FAQ => Topic started by: Kyo on 2012-Jul-31

Title: Help Android Export
Post by: Kyo on 2012-Jul-31

Hi,
I tried to compile my code to Android, but it returns this error:

Code (glbasic) Select

compile+link:
running Android build-script...
BUILD STAGE 1: Compile and pack RELEASE
Exception in thread "main" java.lang.RuntimeException: Failed to create Q:\Compiler\platform\android\android-sdk-windows\add-ons.
at com.android.sdklib.SdkManager.loadAddOns(SdkManager.java:665)
at com.android.sdklib.SdkManager.createManager(SdkManager.java:144)
at com.android.sdkmanager.Main.parseSdk(Main.java:221)
at com.android.sdkmanager.Main.run(Main.java:118)
at com.android.sdkmanager.Main.main(Main.java:102)
Buildfile: build.xml does not exist!
Build failed
.
BUILD STAGE 2: Build DEBUG and install on device
Buildfile: build.xml does not exist!
Build failed
finished Android build-script.


I installed the 32 bit version of Java JDK: jdk-7u5-windows-i586.
I created the environment variable: JAVA_HOME.
I installed the Android SDK, but I do not know what should I download on the SDK Manager.
I downloaded the Android SDK Manager: all API version 4.1 and version 2.3.3 and USB Driver Google.
I created the add_ons folder and now there is a path: C: \ Program Files (x86) \ GLBasic \ Compiler \ platform \ Android \ android-sdk-windows \ add_ons
I tried deleting the folder Android, contained in the folder distribute 
and after I went to File -> Project -> Clean Up, and then I redid the Build Multiplatform, but the error remains.

I use Windows 7 Ultimate 64 Bit.
What is wrong?
I do not understand why the compiler searches the drive Q.

Sorry for my bad English.
Thank you for help.  :good:
Title: Re: Help Android Export
Post by: MrTAToad on 2012-Jul-31
Did you create add_ons or add-ons ?  One will work, and the other wont!
Title: Re: Help Android Export
Post by: Kyo on 2012-Jul-31
Ohhhhhhhhh Yessssssssss you're right  :booze:

Now I copied the file created: glbasic-debug.apk

in the micro sd, and I installed the APP but appears not to work ...

Can you tell me how you start the Android emulator?

thank you!  :good:
Title: Re: Help Android Export
Post by: MrTAToad on 2012-Jul-31
With the Android emulator you need to activate "allow third-party applications", and then :

Start the console ("Start -> Run... -> type 'cmd'" for Windows computers). Type-in the following command: adb install $APK where $APK is the name of the APK file. For example: adb install Snake.apk

It will only install if there is enough space.

Once done, when you go into the main menu the application should be there.
Title: Re: Help Android Export
Post by: Kyo on 2012-Jul-31
thanks for the explanation.  :good:

One question: why the first time if I launch the app there is a long time to run?
Title: Re: Help Android Export
Post by: Moebius on 2012-Aug-01
The first time your GLB app runs, all of the media files are copied out from the apk package - this takes a long while, but then afterwards your apps should start quite quickly.
A loading symbol or splash screen while the media files are copied *might* be implemented eventually (I'm not to sure on where this has gotten, but it isn't that much of a problem)
Title: Re: Help Android Export
Post by: Kyo on 2012-Aug-01
Thanks for the reply.  :booze:

The only problem is that the startup time of the APP the first time is slow, then the screen goes into auto lock.

If you touch the screen as it boots, the message asking to kill the APP.

Other questions:
- No way to use the bluethoot on Android?
- My game is in 480x320 mode (works fine on Samsung Galaxy Ace) there is a quick way to change resolution for other devices (Samsung S2 Galaxy: 800 x 480 - Samsung S3 Galaxy 1280x720, etc.), with the resize of the sprite to maintain the correct position on the screen.
Title: Re: Help Android Export
Post by: Moebius on 2012-Aug-01
The startup time isn't great, but you *might* be able to display a splash screen or prevent autolock by modifying the java code, but I'm not sure if anyone's succeeded yet.  Anyway it's not too bad that a native GUI is being developed first  =D

There's no way to use bluetooth with GLB commands, but using inline code and by modifying some of the java it should be possible - although I wouldn't know where to start...

On rescaling, I personally cheated and rendered everything to a 480x320 virtual screen (CREATESCREEN, USESCREEN, etc.), which I then rotate and display.  Code has been posted in the forums though - for instance http://www.glbasic.com/forum/index.php?topic=7145.0 (http://www.glbasic.com/forum/index.php?topic=7145.0)
Title: Re: Help Android Export
Post by: Kyo on 2012-Aug-01
I found the routine .
It works great.  :good:
Title: Re: Help Android Export
Post by: Kyo on 2012-Aug-02
I do not understand, on Huawei U8650 (600 mhz processor and 256 MB RAM) the game runs at 60 FPS, on Galaxy S3 runs between 30 and 40 FPS.  :S

Mystery ...

The auto lock of the screen  is a stress ..  :rant:

Unfortunately, the routine for resize of the sprite does not preserve aspect ratio when switching from a 480x320 to a 1280x720.

The sprite is warped on Y.
Title: Re: Help Android Export
Post by: JFG on 2012-Aug-12
I have the same problem with my S3.
Check this post for details http://www.glbasic.com/forum/index.php?topic=8367.0

I'm still trying to figure this out. Performance hit seems to come from the SHOWSCREEEN command.
Also, my game will run at 20 FPS for a few seconds, then 60 FPS for a few seconds, then back to 20 FPS.