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 the very latest NodeJS

You can get it from the Node.JS website

NodeJS Download

2. Install PhoneGap

Follow the on-screen instructions “Install” instructions on the PhoneGap Install Page

PhoneGap Download

3. Download the JDK 7

You can get it from Oracle’s website Once it has been downloaded, install it. If you are using (Ubuntu) Linux, use this guide

JDK7 Download Button

4. Download Android Studio

You can get it from the Android website and install it. (NB: The old Eclipse-based ADT may work as well if you already have that, otherwise, download Android Studio)

Android Download Button

5. Update your Path

You must update your path for phone gap to work

Windows

the steps change depending on your version of Windows, but should be similar to these steps:

  1. Click on the Start menu in the lower-left corner of the desktop, right-click on Computer, then click Properties.
  2. Click Advanced System Settings in the column on the left.
  3. In the resulting dialog box, press Environment Variables.
  4. Select the PATH variable and press Edit.
  5. Append the following to the PATH based on where you installed the SDK, for example:

     ;C:\Development\adt-bundle\sdk\platform-tools;C:\Development\adt-bundle\sdk\tools
    

    NB!! The string should reflect the path to the Android Studio bundle on your machine! Also note that the path to Android Studio appears twice in the string (once to point to …\platform-tools and once to point to …\tools), and you need to change both occurences!

  6. Save the value and close both dialog boxes.
  7. Reboot your laptop.

Mac OS X

  1. open or create ~/.bash_profile and add the following line:

     export PATH=${PATH}:"/Applications/Android Studio.app/sdk/tools":"/Applications/Android Studio.app/sdk/platform-tools"
    

    Update the path to Android Studio as necessary if you did not install it in /Applications.

  2. Quit and relaunch the terminal.

Linux

You should know how to update your path on your preferred linux flavor :) Just make sure you update the path to include both sdk/tools and sdk/platform-tools

6. Create your first phonegap app & run it

Open a brand new terminal (necessary to pick up the path changes) and try the following commands (one at a time):

    phonegap create my-app com.example.myapp MyApp
    cd my-app
    phonegap run android

7. Confirm it works in the emulator

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, or go through the intro guide to Android inside the emulator to make it launch. In other cases, you will need to wake the emulator by clicking or click-swiping across the screen to “unlock” the phone

You should eventually see the Apache Cordova logo and green text appear after a while. If you see it, your are ready to attend the class!

Cordova Scren