PhoneGap Installation Instructions for Android

Please complete the following steps to ensure that you have everything installed that you will need in order to build for Android using Phone.

  1. Download and Install NodeJS

    Install NodeJS
    1. Go to the NodeJS site and click on the "Install" button, which will download the NodeJS installer.
    2. Launch the installer and follow the steps to install NodeJS.
  2. Install PhoneGap

    Install Phonegap
    1. You must complete the installation of NodeJS before proceeding.
    2. Mac: Open the Terminal application and type the following command
      sudo npm install -g phonegap
    3. Win: Open the Command Prompt application and type the following command
      npm install -g phonegap
    4. Close the Terminal/Command Prompt
  3. Install Java

    Install Java
    1. Go to the Oracle site and download the Java SDK for your platform.
    2. Launch the installer and follow the steps to install.
  4. Install Ant

    Install Ant
    1. Open the Terminal/Command Prompt application
    2. Type
      and hit Return.
    3. If you see the following, ant is installed - even though that message definitely doesn't sound like it!
      Buildfile: build.xml does not exist! Build failed
    4. If you are told that Ant is an unrecognized command, you will need to download and install Ant.
      'ant' is not recognized as an internal or external command, operable program or batch file.
    5. Go to the Apache Ant site and download the Ant binary.
    6. Unzip the downloaded file and move the folder to a location of your choice. Just remember where you put it, because you will need to add the path to it to your system paths.
  5. Install Android Studio

    Install Android Studio
    1. Go to the Android Developer site and download Android Studio.
    2. Launch the installer and follow the steps to install.
  6. Update Your Path Variables

    Update Path Variables


    1. Click on the Start menu then right-click on Computer, then click Properties.
    2. Click Advanced System Settings in the column on the left.
    3. In the dialog box, click Environment Variables.
    4. Select the PATH variable in the upper section of the window and press Edit.
    5. Append the following to the PATH based on where you installed the SDK, for example:
      Note: 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 add both occurences!
    6. If you needed to install Ant:
      1. Append the location of the Ant folder to the PATH variable:
        Note: the path includes the "bin" folder
      2. Click OK to save the updated PATH variables.
      3. Click New to add a new User variable.
      4. Give the new variable a name of ANT_HOME.
      5. Enter the path to the Ant folder as the value for the ANT_HOME variable:
        Click OK.
    7. Click New to add a new User variable.
    8. Give the new variable a name of JAVA_HOME.
    9. Enter the path to the Java JDK that you installed as the value for the JAVA_HOME variable. It is probably located at:
      C:\Program Files\Java\jdk1.7.0_45
      Click OK.
    10. Save and Close the dialog box.

    Mac OSX

    1. Open or create ~/.bash_profile in a text editor.
    2. Note: The filename begins with a period. This makes the file a hidden file. To open a hidden file, you will need to use an app that can do this, such as TextWrangler, or follow the instructions here.
    3. Add the following line:
      export PATH=${PATH}:"/Applications/Android":"/Applications/Android"
      Update the path to Android Studio as necessary if you did not install it in /Applications
  7. Test PhoneGap

    1. Open the Terminal/Command Prompt. Note: After you modify your PATH, you should quit and relaunch the Terminal/Command Prompt application to ensure that it gets the updated path variables.
    2. Enter the following (responses have been omitted):
      cd /Users/YOURUSERNAME/Desktop
      phonegap create MyApp com.test.myapp MyApp
      cd MyApp
      phonegap local build android
    3. If everything is installed correctly, you should see the following in the Terminal/Command Prompt:
      [phonegap] adding the Android platform...
      [phonegap] compiling Android...
      [phonegap] successfully compiled Android app

Congratulations! Your laptop is ready to build Android applications using PhoneGap.