PhoneGap / Cordova Instructions for Android
Screenshots are made from Mac OS X but these instructions will work on Linux and Windows as well.
- Download PhoneGap. You should be using PhoneGap 2.9.0. (Later versions of PhoneGap may work as well but are not supported for this training, as it usually takes a few weeks for releases’ compatibility with all platforms to be fully understood.) You can find older versions of PhoneGap on Adobe’s website, if you scroll a bit down the page. Once the archive has downloaded, extract the zip and leave it in your downloads folder.
- Download the JDK 7 from Oracle’s website Once it has been downloaded, install it.
If you are using (Ubuntu) Linux, use this guide
- Download the Android ADT Bundle from the Android website. (Android Studio may work as well, but is not supported for this training, as it is still alpha/pre-release software.)
- Extract the ADT Bundle in place… Do not separate the folders from each other.
- In the adt-bundle-… directory, there should be an “eclipse” directory. Enter it and double click the Eclipse icon.
- You should see a splash screen that says “Android Developer Tools”
- If necessary, accept Workspace creation. You can leave it to the default location or choose a different location.
- If necessary, dismiss the “Getting Started” page (cross button on the tab).
- Go to the File menu (upper left) and select Import.
- Select Android > Exisiting Android Code Into Workspace
- Click Browse
- Navigate to phonegap-2.8.0/lib/android/example and Open
- You should see a project in the list of Projects to Import. Click Copy projects into workspace and Finish
- Select cordovaExample in the Project Explorer, and go to Project > Properties
- Select Android on the left, and make sure in Project Build Target, only Android 4.2 is selected (API Level 17) and click OK.
- If you have an Android Phone, use the official Android guide to set up your device and click Run to run the app on your device.
- If you do not have an Android phone, Go to Window > Android Virtual Device Manager
- Click New
- Name: “MyPhone” (or whichever name you want, no special characters, no spaces)
Device: 3.2" HVGA slider (ADPI)(320 x 480: mdpi)
Target: Android 4.2 — API Level 17
Keep Internal Storage at 200MiB
- Close the Device Manager and click Run
- You should see a black emulator window open, then the word Android will appear and flicker for a while. This means the emulator is starting up correctly. It may take it up to 10 minutes to load
- If it is the first time you run the emulator, you may need to dismiss the welcome messages inside the OS before the app can start. In some cases, you may need to quit the emulator and Run the app again to make it launch.
- You should eventually see the Apache Cordova logo and green text appear after a while