Category Archives: PhoneGap

How to Install PhoneGap in Ubuntu




1. First, check you’ve got Java and Ant installed – you’ll need those later:

sudo apt-get install default-jre
sudo apt-get install default-jdk
sudo apt-get install ant

2. Install npm

sudo apt-get install npm

3. Get the latest nodejs (by installing ‘n’ and running that):

sudo npm update npm -g
sudo npm install n -g
sudo n stable

4. Now install phonegap itself

sudo npm install -g phonegap

5. Download the Android sdk from, put it somewhere sensible and unpack it:

sudo mv ~/Downloads/ /opt/
cd /opt
sudo unzip
sudo chmod -R 777 /opt/adt-bundle-linux-x86-20130917

6. Update PATH in ~/.bashrc to include the phonegap tools:

# Add android sdk

and then ‘source ~/.bashrc’ to make sure you’ve got the new path setup.

7. Create a phonegap app (I use a “projects” subdirectoy):

cd ~/projects
phonegap create my-app
cd my-app

8. Before you run the app, you’ll need to set up an emulator – run the android tool:


9. You may need to select a target (e.g. “Android 4.2.2 (API 17)”), and click the “Install 8 packages..” button (may need several clicks to accept all the licences)

Now setup and start an emulator – in the ‘android’ util, go to Tools -> Manage AVDs, go to the “Device Definitions”, select a device, and use the “Create AVD” button to create a new AVD. Then use the “Start..” button to start the AVD (it may take a surprisingly long time to start fully).

Run the app:

phonegap local run android

You should see the app compile and install on the emulator.

You can do the compile and install steps separately:

phonegap local build android
phonegap install android

10. Add plugins
Optional Step

phonegap local plugin add
phonegap local plugin add


Original tutorial found at

Leave a comment

Posted by on May 1, 2014 in PhoneGap