Generating binaries

Introduction
Since android doesn't use the Sun JVM, using some of the more familiar tools will be out of hand when you need to compile your files for distribution. Android uses the .apk files for distribution. Think of them as the ubiquitous .sis files that are used in symbian phones for installing applications.

Using the IDE's compiled file
There are basically two methods to do this. One is to use the file automatically compiled by your IDE in your /bin In my case, it's the /posit/hfoss-posit/hfoss-posit.apk

Go to step three if you decide you don't really want to package it using the second method.

Right click on the project folder, and select Android Tools at the very bottom. There's a "export application package." It will export the apk file for you.

Using aapt
The other way is to use the aapt tool provided by google android in the /tools directory.

A nifty trick here that I use is to make an alias for this tool so that I don't need to keep putting the whole location. Alternatively, you can add the directory to your $PATH variable and you get all the tools. Of course, remember to add them to your ~/.bashrc file.

The command

$cd /the/folder/ $aapt p -M AndroidManifest.xml -I org.hfoss.posit -S res/ posit.apk (Please remember to replace the org.hfoss.posit with your own base package name and posit.apk with the apk name you want to generate)
 * Go to the project folder
 * Run the aapt with the following command

How to load the executable to the phone
$emulator
 * Run the emulator with the emulator command unless it's already running

$adb install posit.apk
 * Install file

This saves the file into the /Data/ folder in the android device.

How to clean Android

How to Run the file
Running can be a bit tricky, especially if you haven't added access to the activity launcher by adding this to your AndroidManifest.xml file



between   ---Here--- 

I recommend adding this provision of loading the file from the launcher. Helps loads. However, it's a nice feature to have some option for loading file from the command line itself. You need to use the am command to do this The syntax goes like this am [start|instrument] am start [-a ] [-d ] [-t ] [-c [-c ] ...] [-e   [-e   ...] [-n ] [-D] [ ] am instrument [-e  ] [-p ] [-w] Here it goes:

$adb shell
 * Enter the shell
 * 1) am start -n org.hfoss.posit/org.hfoss.posit.PositMain

As you can see that I'm running using the base package name and the full Activity name. Post here if you find any different/better ways.