Getting started guide for PhoneGap in Ubuntu 13.04

PhoneGap getting started guide is helpful for Windows and Mac users. But Linux users (Ubuntu distro mainly) left in dark.

I first tweeted about it in Twitter and a PhoneGap employee replied as below

So I decided to try it myself.

Ubuntu 13.04 Phonegap

Out of scope

Before starting following are out of scope of this article

  • Setting up dev environment for Android
  • Setting up path for Java

Make sure to do both points mentioned above to jump follow my tutorial below

Install ant

To build a PhoneGap app you will need ANT installed in your machine. Run the following command to install ant in your machine

sudo apt-get -u install ant

Android SDK path

Now set up the PATH for your Android SDK. Open the terminal and type the command below.

nano ~/.bashrc

Add your path to sdk folder (tools, platform tools)

export PATH=${PATH}:/opt/android/sdk/tools
export PATH=${PATH}:/opt/android/sdk/platform-tools

If your Android sdk is in differnt path make sure to change the path I’ve given above.

Download PhoneGap

Now go to PhoneGap web and download the PhoneGap package

Save it in your local folder. Now navigate all the way into the bin folder. For example I saved it in /home/development/phoengap-2.8.1. Path is given below

>
development/phonegap-2.8.1/lib/android/bin

Now run the following command to create a test project. This is same as what is given in PhoneGap’s documentation.

./create /home/mayu/testpgproject com.mayuonline.testproject MayuTestProj

Now follow the PhoneGap documentation and import the created project into your Eclipse work environment (or any other IDE you use).

If you get permission denied error message make sure that the files inside the bin folder has executable rights. In above line of command, the “testproject” is newly created. So make sure there is no folder already exists with that name. If you have a folder exist with that name already you will get error message.

Let the PhoneGap dev begin in Ubuntu <3.

Did you enjoy this article?
Signup today and receive free updates straight in your inbox. We will never share or sell your email address.

Leave a Reply