Quick PhoneGap setup on Ubuntu

(tested on Ubuntu 14.04)

Install NodeJS

Go to https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager to get the following instructions updated:

curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install nodejs

Install PhoneGap

sudo npm install -g phonegap
sudo npm install -g cordova

If some part of the output of this (xcode, etc) gives error messages, I recommend uninstalling (sudo npm uninstall phonegap) and trying again, to avoid weird dependency issues later on.

The Cordova installation seems not to be mandatory, although you will need it if you start installing Cordova plugins.

Create a PhoneGap app

phonegap create my-app
cd my-app
phonegap run android

This last line is to run it as an Android app (but you can also do that in other environments).

If, for some reason (libraries dependencies, etc) the last line doesn’t work, you can still test your app launching the PhoneGap local server in what I understand is a special independent web mode, by typing

phonegap serve

This will give you the IP that you need to give in the next step.

Test your PhoneGap app

Since recently, PhoneGap offers a PhoneGap “app” that will allow you to run a locally-developed app on your device.

See instructions here http://app.phonegap.com/ (or basically download the “PhoneGap Developer” app).

Installing the Android SDK

Remember the failing “phonegap run android” command above? Well, this was due to the missing Android SDK. To get it, you need to do something like this:

wget http://dl.google.com/android/android-sdk_r23.0.2-linux.tgz

And then uncompress the file

tar zxvf android-sdk_r23.0.2-linux.tgz

Finally, you’ll have to add the path to some of the subfolders of this uncompressed archive to your PATH system variable:


export PATH

If you only do this, you’ll have to repeat this action after each reboot (at least when you want to “phonegap run android”).

Building on PhoneGap.com

Once you have a working test, or if you don’t want to build the whole environment locally, go to https://build.phonegap.com and register to be able to build applications with PhoneGap’s online service. This is free for open source projects hosted on Github.

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on TumblrEmail this to someone

Leave a Reply

Your email address will not be published. Required fields are marked *