Creating Android PhoneGap project

The process to create project in Eclipse: 1. New project from existing code 1. Refactor the names 1. Put the project (with web standards) code into the www folder.

New project

New project from existing code

To create a new project, we select New > Project > Android > Android Project from Existing Code.

Locate the phonegap example project

Copy to workspace

Eclipse will ask where is the existing code. We locate the example project in the <PhoneGap Downloaded Folder>/lib/android/example. Make sure the Copy projects into workspace is selected.

Refactor to rename

The project is copied into the Eclipse workspace now. But it is still called “org.apache.cordova.example”. We would rename the project by right click on the project and choose Refactor > Rename.

Rename java project

The project name often comes with namespace which is in reverse-domain style. For me, I would make it “net.makzan.html5cheatsheet”.

Set android app name

Then in the strings.xml, we set value of the app_name to the name appear on Android apps screen.

Then run the project and the virtual device will launch with the PhoneGap app.

Issue: Unable to resolve target “Google Inc.:Google APIs:X”.

Set the target API in the manifest, then restart Eclipse.

What’s next? We’re going to take a look at “The node.js approach”.

overlaied image when clicked on thumbnail

Makzan | Mobile web app dev with phonegap | Table of Content