RSS

Category Archives: PhoneGap

How to Install PhoneGap in Ubuntu

PhoneGap

PhoneGap

 

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 http://developer.android.com/sdk/index.html, put it somewhere sensible and unpack it:

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

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

# Add android sdk
PATH=$PATH:/opt/adt-bundle-linux-x86-20130917/sdk/platform-tools:/opt/adt-bundle-linux-x86-20130917/sdk/tools

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:

android

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 https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-media.git

 

Original tutorial found at
http://julianhigman.com/blog/2013/10/17/notes-on-setting-up-phonegap-on-ubuntu-for-android-app-development/

 
Leave a comment

Posted by on May 1, 2014 in PhoneGap

 

Tags: