I have another newbie question, and the answer is probably obvious to the experienced GLBasic coders here! :)
I'm now learning to program in GLBasic for Windows, but do not know how to make GLBasic compile to an APK file so that I can test to see if the program works on my Android mobile/cellphone. Do I, for example, have to install the Android SDK? Is there a link anywhere that I can go to to read up on the Android development process for GLBasic?
Thanks!
You need the Java SDK (32 bit version) and to set JAVA_HOME and what not.
Thanks for a quick reply! Are you saying that I should go for the Java SE Development Kit for Windows x86 rather than for Windows x64? If possible, can you also kindly explain why the latter will not work? Thanks!
Couple of handy links...
http://www.glbasic.com/xmlhelp.php?lang=en&id=404&action=view
http://www.glbasic.com/forum/index.php?topic=6169.0
http://www.glbasic.com/forum/index.php?topic=8200.0
Thanks for the helpful links, bigsofty!
yep, there are a bunch of topics on that, check them first.
Let us know if trouble arrises that is not covered on the forum already.
But in general, you instal sdk6(32bit), yep, the x86 one.
You have to add a line on your system variable, the JAVA_HOME one. Those topics may cover that and the manual has some tips too.
Set your phone, of debbuging options or dev options to USB debugging.
Overall, in my case, it does not send the file automatically to the phone, so I have to copy the file glbasic-debug.apk, located on your projects folder, distribute/android/bin , after you compile, to some location on your device, then you just run that and it should install and ask if you want to run it.
Be aware that you have to set your project resolution and in code resolution to that of your device if it is a quick test.
There is code around the forum that handles multiple resolution but so far I could not implement it.
My way, I hardcode the resolutions of the devices I want my app to run.
Cheers!
Thanks to you guys for all the help! I've installed the Java SDK, added the environmental variable, and rebooted (just in case).
erico, after compiling the program to android, I see the distribute/android folder, but the only subfolders attached to this are: assets, libs, res, and src. I don't see a bin subfolder. I assume the ASK file will be in the bin(ary) folder, but I don't see a bin folder. Do you know where I'm going wrong? :(
Sorry, I think I set the environment variable incorrectly - let me see to that first!
That is strange, there should be a BIN folder in there, are you sure it is not hidden or something?
Inside you should find the glbasic-debug.apk
What are the msgs you get from the compiler window after you set it to compile to android?
Does it state that if found java and so on bla bla?
Don“t forget to add android to your project settings too just in case.
Still can't find the BIN folder... I got an output like this: not sure if this is good or bad! :)
_______________________________________
*** Configuration: ANDROID ***
precompiling:
GPC - GLBasic Precompiler V.9.829 SN:e50f7495 - 3D, NET
Wordcount:165 commands
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.
Android=C:\Users\Robert\Documents\GLBasic files\Breakout\distribute\Android
success
_______________________________________
*** Finished ***
Elapsed: 3.7 sec. Time: 17:21
Build: 1 succeeded.
Try File -> Project -> Clean Up and then make another attempt.
Thanks, finnk.
Unfortunately, same result after the clean-up. :(
I also tried the advice from the following link:
http://www.glbasic.com/forum/index.php?topic=8013.msg67162#msg67162
by MrTAToad to "Try manually creating the add-ons directory in <program files>\Compiler\platform\android\android-sdk-windows\add-ons" in C:, C:/Program Files, and C:/Program Files (x86), but none of these seem to work either. :(
Maybe it has something to do with "GLBasic files" having a space in it. I don't know why I think that, but maybe that could have something to do with it. If you change it to an underscore, make sure to also modify anywhere that path might appear. Project settings etc... Also clean up again. Maybe even delete the auto-generated folders not a part of your project source and try building again.
Good suggestions, finnk. Let me change these and try again!
OK, I finally got a bin folder and APK file by doing the following - I just added an "add-ons" folder to the following: "...\GLBasic\Compiler\platform\android\android-sdk-windows" folder. This was from advice from the following thread: http://www.glbasic.com/forum/index.php?topic=8248.msg69715#msg69715
Sounds like a bug that should be corrected for the next version.
Update: Got it working on my Android - thanks to everyone who responded. Of course, not perfectly as the screen size is wrong, but at least it is working! :)
It seems different win versions and java sdk installs behave differently, maybe android sdks too?
I run win7 68bit N. I did not get these line of troubles but I got others, it was just a bunch of work to figure it out (thanks to our fellas here :nw:) and now it all goes fine, and I can reproduce it on systems running same win version and java sdk procedures.
It is really nice it works out now SFguy!
Do you have your app going on your phone fine?
Thanks for your help, erico, and for the others who posted here, I've got the app going on my Samsung phone. It is really good seeing it work on my phone because I was almost losing hope and thinking that I should develop instead on Corona SDK as the Corona SDK website gave an example that ran perfectly on my phone the first time around! :D
At least I can now rest assured that I can continue developing this program without the fear that it will not port well to mobile. However, I still need to learn how to tailor the game to the screen resolution of the mobile (which seems problematic from what you have written on this forum), but I think I'll work more on the game first.
Good to hear SFguy! congrats! :good:
I was really glad I got stuff going on my phone too, a samsung model.
One thing, it is important to post how you did it, so future/current users on the forum can find such solution by searching around.
Also, it is even more important so GLB devs can check it out too...may make it easier for all in the future.
Corona is fine, and you will notice people post about a lot of other dev tools that are nice too.
It all really depends on your needs.
Edit: you did state how you got it solved..sorry, my bad. :-[
I believe the beta has this fixed...