Help beginners guild to gettig GLBasic with Android.

Previous topic - Next topic

spudgunjake

I have been using GLbasic with my Iphone for some time, I would like to use Glbasic with my new android desire S (Gingerbread).

Can anyone tell me, What I need to develop Android software with my GLbasic, I see lots of talk but no guild /  examples what I need to download to get working.

Can anyone help.

Best regards John.

MrTAToad

What you need to do is download the Android SDK and update it.  You also need to download the Java SDK too.

Once that is done, you need to setup various environment variables.  Once done you can then compile for Android.

I think this should cover most of the details you will need (taken from my GLBasic Programmers Reference Guide book) :

QuoteCompiling for Android is not as straight forward as the other platforms, as it requires the downloading (for development purposes only) of two other SDK's – the Java SDK and Android SDK

The Java SDK can be found at http://www.oracle.com/technetwork/java/javase/downloads/index.html, whilst the Android SDK is at http://developer.android.com/sdk/index.html

The Java SDK (only use the 32-bit version) can be installed anywhere (and can have spaces in the path name), and needs to be done before the Android SDK is installed.

Once done, you will need to add JAVA_HOME environment variable to point to the directory containing the version.  So, for example, if the version 6.25 of the JDK was installed in C:\Program Files (x86)\Java, JAVA_HOME would be set to C:\Program Files (x86)\Java\jdk1.6.0_25

This path should also be appended to the PATH variable too

Once done, the Android SDK can now be installed.  This should do in a directory path that has no spaces (so the usual Program Files directory is out!).  Usually on the first run, it will say that the Java SDK couldn't be found, but if you click on BACK and then NEXT again, it will be magically okay.

Before installing, make sure everything is selected.

Once completed, you have one more environment variable to setup.  This is called ANDROID_SWT and should be set to the 32-bit version of swt.jar in the android-sdk\lib directory.  So, for example, if the Android SDK was installed in C:\Android, ANDROID_SWT would be set to C:\Android\android-sdk\tools\lib\x86

As a GLBasic program can run on an Android emulator, you may want to test your programs on that first.  It should be noted that a lot of extensions are not supported, so the display may not be the same as an actual device.

To install an application on the emulator, you use (assuming %PATH% points to the Android program directory) :

adb install your_application.apk

With your your_application.apk pointing to the APK file that you want installed.

You can also grab emulator screenshots if you run ddms before you start the emulator.
Android Marketplace

Submitting an application to the Android Marketplace is just as simple as a webOS submission, although you do have to pay (at the time of writing) $25 (around 16.90 Euros or £14.98).

In addition, before you can submit a program, you have to sign it with a developer key.  To do so, follow these steps :

Build your application for Android
Make sure your JAVA paths are correct and setup in %PATH%
Create a folder called keytools and make a folder in that called keys.  The best place to do so would be the root of your GLBasic project folder
Copy the glbasic-debug.apk file in your projects android/bin directory, into the keytools directory.

As the APK file has been signed with a default key, this needs to be removed and replaced with one acceptable for the Marketplace.  This means using an application like WinRAR or 7ZIP to remove the contents of META-INF directory.  Once done, the code-signing process can continue :

Open a command prompt (CMD.EXE)
Move to the keytools folder (for example using C:\Users\Nicholas\Documents\GLBasic\Keytools)

Type in : keytool -genkey -alias mykey.keystore -keyalg RSA -validity 20000 -keystore keys/mykey.keystore

You will then be asked the following questions (all of which must be answered) :

Password
Full name
Name of your organisational unit
Name of your organisation
Name of City/Locality
State/Province
Two letter country code

After which, you can press RETURN to use the standard key.  Once you are back at the command prompt, type in the following : jarsigner -verbose -keystore keys/mykey.keystore -signedjar glbasic-signed.apk glbasic-debug.apk mykey.keystore

Your application will now be signed.  At this point, it would also be a good idea to zipalign the APK file.  This can be done by typing in :

zipalign -v 4 glbasic-debug.apk glbasic-signed.apk

which will output something like :

Verifying alignment of glbasic-signed.apk (4)...
      60 assets/Media/smalfont.png (OK)
    3944 res/drawable/icon.png (OK)
    8560 res/layout/main.xml (OK - compressed)
    8910 AndroidManifest.xml (OK - compressed)
    9652 resources.arsc (OK)
   10537 classes.dex (OK - compressed)
   20262 lib/armeabi/gdbserver (OK - compressed)
   94389 lib/armeabi/libmain.so (OK - compressed)
  596294 lib/armeabi/libmikmod.so (OK - compressed)
  699032 lib/armeabi/libSDL.so (OK - compressed)
  906556 lib/armeabi/libSDL_image.so (OK - compressed)
1008474 lib/armeabi/libSDL_mixer.so (OK - compressed)
1108476 lib/armeabi/libSDL_ttf.so (OK - compressed)
Verification succesful

When you have paid your Marketplace fees, you can submit your application to the store.  Acceptance is almost instant, so there is little in the way of application review before it is accepted.

In addition to the standard Android Market, it might also "pay" to submit it to the 1mobile.com site as well.  To do so, create an author account at http://author.1mobile.com/

Kitty Hello

It should work with:
-Install Android SDK
-Install Java JDK (Java developer SDK)
-Set system environment variable JAVA_HOME like:
   JAVA_HOME=C:\Program Files (x86)\Java\jdk1.6.0_24
-Install GLBasic SDK v10 RC (or higher - for future reference)
-Set project options for "Android"
-Start the emulator or plug your real device in
-Build for Android
-Watch it run

(please add if  step is neded - I have to updat the manual, yet)

spudgunjake

Many thanks for the long info,

If I develop software for in-house apps would the signing be any different, with all use Android desire here, and we need some software for our solicitors  to use.

spudgunjake


MrTAToad

Code signing is quite easy.  Unfortunately I have found that no DOS based compression program (7zip, RAR, ZIP etc) will not handle Android APK files (as they say its in an invalid format), so everything has to be done by hand :(

Kitty Hello


MrTAToad

Ah, yes, 7zip likes that...

WinRAR doesn't :)

Should be able to create a batch file to automate it all now :)

Kitty Hello


spudgunjake

I have done I believe everything right, but When I compile now I get this. Im I missing something.

John.

*** Configuration: ANDROID ***
precompiling:
GPC - GLBasic Precompiler V.7.917 SN:72be2326 - 2D, NET
Wordcount:2180 commands
compile+link:
BUILDSRIPT

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

Total time: 22 seconds
Android=D:\GLBasic\iphone\distribute\Android
success
_______________________________________
*** Finished ***
Elapsed: 110.7 sec. Time: 10:59
Build: 1 succeeded.

MrTAToad

That sounds like the android icon file is missing - it wont get created with old projects. 

If you haven't got androidicon.png anywhere else, you'll need to create a new project, compile for Android and then copy it into your other project.

Goos

Hi i am programming GLBASIC for Android and it works great with my ASUS Transformer.
I want to know is ther a way to include a map in the APK. Glbasic makes a map for windows myprog.app and in there a map called media.
i must copy the map media to the android device. I have a program that uses the media map. So i want to ask if i can include it in the apk.

MrTAToad

Stick all data into the Media direction and it will be included when the APK file is created.

Goos


spudgunjake

I found the error I was getting was due to the emulator wasnt started or my HTC Desire wasnt plug in.

Every thing is working fine and I would like to thanks everyone for their input, 

best regrards John.