07/13/14

Creating a new PhoneGap 3.5 project on Windows

I upgraded to Phonegap 3.5.0 a few days ago and I found some differences when creating a new project for Android, so after a couple of errors I ended up using this steps to create a new project for Android under Windows 7:

  • Download and install Git: http://git-scm.com/download/win
  • Download and install Node.js: http://nodejs.org/
  • Open a new Ms-DOS window and type:

npm install -g phonegap

  • Now create a new project:

phonegap create NewApp com.example.NewApp NewApp

  • Enter to the new project directory and type:

phonegap build android

  • If we need to add plugins:

phonegap plugin add org.apache.cordova.media

phonegap plugin add org.apache.cordova.file

  • Build again

phonegap build android

  • In Eclipse, create a new project from existing code, and select the project previously created.
  • Two projects will appear on the list, MyApp and Myapp-CordovaLib. Select just MyApp, and enable copy to workspace.
  • Once imported, go to project properties->Resource->Resource filters and delete the two existing filters (This way we’ll see the www folder in assets).
  • Go to project Build Path, and in the source section, add folder and select CordovaLib/src folder of the current project.
  • Build from Eclipse to check everything worked.