Most Android SDK documentation is oriented towards Eclipse IDE and it follows that examples / instructions for PhoneGap would be as well. But, not everyone uses Eclipse. Here's how to do this stuff from the command line, so you can use what-ever editor you choose (*cough* jEdit).
The expected environment for these examples is:
- Some 64bit Linux System (we have 3.0.6 kernel, glibc-2.13, ant-1.8.1, jdk-188.8.131.52)
- Android SDK
- PhoneGap >= 1.2.0
- Command Line Experience
- Editor of Choice
Creating the Project
Creating the new Android+PhoneGap project is super easy. Make a directory to hold the project, run the create tool, import PhoneGap
mkdir ~/moile-dev/apgex/ cd ~/moile-dev/apgex/ android create project \ --name 'Android_PhoneGap_EXample' \ --target 12 \ --path . \ --package 'com.edoceo.apgex' \ --activity 'APGEX_Activity'
The project will be created in the current directory. The parameter (12) for target was determined by the output from
android list targets.
The output from that will have numerous IDs, and platforms identified.
On the example system the target identifier of 12 represents Android 2.3.3 (android-10).
The project create above is a base-line Android application, which could be coded now as a fully native application. Now we'll integrate PhoneGap, which we'll finally build our application with.
Note: this used to be managed by a tool called droidgap, which is no longer around.
Now, we simply clone the Sample and start hacking
rsync -av ~/phonegap-1.3.0/Android/Sample/ ~/mobile-dev/apgex/
Hacking the Sample
Now we'll surely want to update the Sample code-base with project specific items. The following list shows a few files that should be modified.
Update Manifest, Install PhoneGap
Make asset Dirs Install PhoneGap JAR and phoneGap JS telnet localhost 5554 emulator-arm -a VMD_NAME