Their getting started section though actually took me hours to get through – despite it not appearing at first glance particularly overwhelming!
I was installing on Win 7 64bit.
One hurdle I came across was not having a Java JDK but only the JRE packages. On top of this, I had multiple JRE6 and JRE7 directories in both the 64bit and 32bit program folders:
C:\Program Files\Java C:\Program Files (x86)\Java
So I went through control panel > programs and removed all Java installations. I then started with a fresh Java Platform (JDK) 7u9 installation which created both a jdk1.7.0_09 and jre7 directory at C:\Program Files\Java.
Installing Android SDK, Eclipse Classic and ADT Plugin
I didn’t run into any major issues (using the above phonegap getting started guide link) doing these stages and also added PDT PHP delvelopment tools while setting up eclipse:
Eclipse > Help > Install New Software > Add (button in top right)
You can then select it from the dropdown and the available packages will load in. PHP is under Programming Langugaes.
Phonegap / Apache Cordova
From http://www.apache.org/dist/incubator/cordova/ I downloaded the cordova-2.2.0-incubating-src.zip and extracted only the android zip file.
Setting Up The Windows Path and Enviroment Variables
Getting this stage done right took a lot of trial and error, and involved attempting the next stage (running the create command at the command propmt and realising something hadn’t worked).
The settings that enabled everything to work as expected required a PATH variable that included:
C:\Users\Joe\AppData\Local\Android\android-sdk\tools;C:\Users\Joe\AppData\Local\Android\android-sdk\platform-tools;C:\Program Files\Java\jdk1.7.0_09\bin;C:\Program Files\Eclipse\plugins\org.apache.ant_1.8.3.v20120321-1730\bin;
As Eclipse includes Apache ANT I used this instead of a dedicated ANT install. As well as the PATH, I added a couple of environment variables:
ANT_HOME C:\Program Files\Eclipse\plugins\org.apache.ant_1.8.3.v20120321-1730 JAVA_HOME C:\Program Files\Java\jdk1.7.0_09
You may notice the ANT_HOME excluse the \bin at the end whereas the inclusion in the path ends with \bin. I tried multiple combinations of this (with or without \bin) and this was the only way to get it working.
When this wasn’t working, the create command create C:\Users\Joe\Eclipse\Android\testapp com.testapp TestApp was finishing without error, but when loading the project in Eclipse I was getting the error: org.apache.cordova can’t be resolved. To get around this initially I downloaded a copy of the phonegap SDK from the github page and copied the cordova-2.2.0.jar to testapp/libs and cordova-2.2.0.js to testapp/assets/www which resolved it. But with the correct ANT_HOME and and PATH set these files appeared as expected after the create command was run.
At this stage, right clicking the project in Eclipse and selecting Run As Android Application I was finally able to get it running without errors (except for a warning related to android.app.Activity not being used).