Getting Started PhoneGap/Cordova on Linux

I was following the guide How to Install PhoneGap in Ubuntu  and I am regurgitating that advice here with my own changes:

Install PhoneGap and Pre-requisites

 

Download Android SDK

Download the Android sdk from http://developer.android.com/sdk/index.html, put it somewhere sensible and unpack it. I downloaded the ADT and unzipped it within my home folder :

Add  the following to your ~/.bashrc file changing it to reflect the path to the SDK within the unzipped Android ADT as neccessary:

Check Permissions

Create a Project

PhoneGap Create

PhoneGap Create

After running “phonegap create” the following directory structure is created:

PhoneGap Blank Project

 Setup the Emulator

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

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

Android SDK Manager Android SDK Choose Packages to Install

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 long time to start fully).

Andriod Emulator

Run the app:

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

PhoneGap Hello World App PhoneGap Hello World App

You can do the compile and install steps separately:

10. Add plugins
Optional Step

 Customise the App

Inside the ‘my-app’ folder the sub-folder ‘www’  contains the HTML, CSS and images needed for the app. To start I will amend the index.html file, the app icon icon.png

Editing the PhoneGap App

A basic jQuery Mobile page(s):

After amending the project files I re-built and viewed the app in the Android emulator again.  During the build the APK package file is created under:

…/my-app/platforms/android/ant-build/HelloWorld-debug-unaligned.apk

 

 

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">