The main steps are already detailed on the official PhoneGap site – http://phonegap.com/start.
Below are my tried and tested steps for your reference to get the Android environment up and a test App running on a Windows 7 machine, then you can add in the steps to create a PhoneGap app from the official guide above.
Getting Started with Running an Android App in Eclipse
1) Download and extract Eclipse Classic 3.7.1, 174 MB from http://www.eclipse.org/downloads.
2) Download the Android SDK installer (installer_r16-windows.exe) at http://developer.android.com/sdk/index.html. Make sure that you change the installation directory to “c:\android-sdk” for example, it must be a PATH with NO spaces! When the installation is done, run SDK Manager and it will download and install some files which will take some time, make sure that Android SDK Tools/Platforms are installed.
3) In SDK Manager window, go to Virtual Devices and add a new device called Android2.3.3 and select Target to be “Android 2.3.3 – API Level 10”, click on “Create AVD”. (You can add more devices with different versions as you please)
4) Run Eclipse and start to install the Android Development Tools (ADT) plugin for use with Eclipse, the repository url is “https://dl-ssl.google.com/android/eclipse/”. Follow the steps here to configure the ADT: http://developer.android.com/sdk/eclipse-adt.html#installing.
5) Start a new Android Project by clicking File > New > Android Project.
- In the New Android Project dialog, select Create project from existing source.
- Click Browse and navigate to where the SDK is installed and select Spinner, e.g. C:\android-sdk\samples\android-13\Spinner
- Android 1.5 will be selected as the Build Target and click on Finish.
- Go to Project -> Clean to build the project.
6) Right-click on SpinnerActivity project and Run As -> Android Application. It will run with the Android 2.3.3 AVD created before.
7) The Android emulator will run and note that it takes a while to load.
Deploy and Run on An Actual Device
1) Depending on the model of your phone, e.g. Samsung or HTC etc, you will need to download the driver for the phone here: http://developer.android.com/sdk/oem-usb.html. In my case, I use the Samsung Galaxy S and I have to install the Samsung Kies software.
2) Follow the instructions to configure your Android phone for Development at: http://developer.android.com/guide/developing/device.html.
3) Then connect your phone to test if it can be detected by the Android SDK using a command prompt and go to “C:\android-sdk\platform-tools” and run “adb devices” to see a list of devices connected.
The output from the command will be something like this:
List of devices attached
4) In Eclipse, right-click on SpinnerActivity project and Run As -> Run Configurations.
5) Click on the Target tab and change the Deployment Target Selection Mode from Auto to Manual and click on Run. This will allow you to choose the device instead of the AVD.
6) Select the device and click OK.
7) The app will be running on your Android phone.
Adding Another Device
1) Follow the same steps as above and depending on your model of your phone, download the correct USB drivers.