1. Android Environment Preparation. In order to develop Android application, you’ll need JAVA Development Kit(JDK), Eclipse, Android Software Development Kit(Android SDK).
a) JDK can be accessed from JDK, and latest version is JAVA 8. After installation, use java -version in CommandLine to check if it is properly installed.
b) Eclipse can be downloaded at Eclipse. Android SDK ADT Bundle for Windows already include everything for Android development: latest Android SDK, Eclispe, Android Emulator, Android SDK and Platform tools.
2.PhoneGap Environment Preparation.
a) Before installing PhoneGap, you should first install NodeJS . Use npm -v to check if nodejs is properly installed.
b) PhoneGap can be installed simply by:
npm install -g phonegap
Use phonegap -v to check the version of it.
c) In order to use cordova utility, Android SDK platform tool and Android SDK tool should be added into system PATH. On Windows, just append environment variable PATH with “/Development/adt-bundle/sdk/platform-tools:/Development/adt-bundle/sdk/tools”.
d) Create app with cordova.
$ cordova create hello com.example.hello “HelloWorld”
$ cd hello
$ cordova platform add android
$ cordova build
3. Edit and run application in Eclispe.
a) Lunch Eclipse and choose File->Import->Existing Android Project. Set file path to the directory of hello project. And both hello and hello-CordovaLib should be selected, and choose Finish.
b) Click Run->Run as Android Application. Then there’ll be a dialog to decide a device for application to run on, then just choose your android phone or android emulator.
Here shows the result of hello running on my phone: