PhoneGap / Cordova Instructions for Android

Screenshots are made from Mac OS X but these instructions will work on Linux and Windows as well.

  1. 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.

    PhoneGap Download

  2. Download the JDK 7 from Oracle’s website Once it has been downloaded, install it.

    If you are using (Ubuntu) Linux, use this guide JDK7 Download Button

  3. 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.)

    ADT Download Button

  4. Extract the ADT Bundle in place… Do not separate the folders from each other.
  5. In the adt-bundle-… directory, there should be an “eclipse” directory. Enter it and double click the Eclipse icon.

    Launch Eclipse

  6. You should see a splash screen that says “Android Developer Tools”

    ADT Splash Screen

  7. If necessary, accept Workspace creation. You can leave it to the default location or choose a different location.
  8. If necessary, dismiss the “Getting Started” page (cross button on the tab).
  9. Go to the File menu (upper left) and select Import.

    Eclipse Import

  10. Select Android > Exisiting Android Code Into Workspace

    Existing Android

  11. Click Browse

    Eclipse Browse

  12. Navigate to phonegap-2.8.0/lib/android/example and Open

    Import Browse

  13. You should see a project in the list of Projects to Import. Click Copy projects into workspace and Finish

    Import Finish

  14. Select cordovaExample in the Project Explorer, and go to Project > Properties

    Eclipse Properties

  15. Select Android on the left, and make sure in Project Build Target, only Android 4.2 is selected (API Level 17) and click OK.

    Android 4.2

  16. 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.

    Eclipse Run

  17. If you do not have an Android phone, Go to Window > Android Virtual Device Manager

    AVD Windows

  18. Click New

    AVD New

  19. 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 Click OK AVD Setting

  20. Close the Device Manager and click Run

    AVD Run

  21. 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

    Android Load Scren

  22. 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.
  23. You should eventually see the Apache Cordova logo and green text appear after a while

    Cordova Scren