The first lesson learned is that there is a lot of stuff to install to get a Windows machine ready to roll with Eclipse‑Android‑PhoneGap development. Second, I learned it is all really finicky regarding version of Ruby, paths, order of install, etc. Third, I learned that getting a stable setup for this on Windows can take a few hours.

You will need to download and install the following:

  1. Java JDK (I got the latest Java at the time; Java SE 6 Update 23. Regardless of the version, be sure to Download JDK not the JRE.)
  2. Apache ANT (Instructions aren't too clear, I just downloaded and unzipped to c:\android-sdk-windows)
  3. Ruby ** DO NOT GET THE LATEST RUBY (currently v 1.9.2); get 1.9.1 **
    Check PhoneGap docs to see if/when 1.9.2 or later ruby for Windows may work.)
  4. Git (msysgit)
    (Here I felt comfortable getting the latest, 1.7.3.1, since it is not directly in the build process.)
  5. Android SDK
  6. Eclipse IDE for Java Developers* (Eclipse 'Helios' version 3.6.1 worked well for me)
  7. Eclipse Web Developer Tools* see paragraph below
    (Not mentioned in PhoneGap Docs, but the ADT  Plugin has a dependency on the Eclipse Web Developer Tools. Another option is to get Eclipse IDE for Java EE developers which already includes the Web Developer Tools).
  8. ADT (Android Developer Tools) Plugin for Eclipse
  9. PhoneGap-Android (Long term you'll be better off cloning via git instead of downloading. Later instructions help with using git clone…)

You can dive in and do the installs like I did, using the instructions from Getting started with Android PhoneGap in Eclipse. Note that there are a quite a few potential gotchas. I'll try to call out some major ones. Some are alluded to above, like "Gotcha #0"— ruby version sensitivity.

Gotcha #1: Order can matter.
Solution: For better results, download and install the the Java JDK first. See gotcha #2 for some tips relating to the Android SDK, Apache ANT, and where you put the phonegap‑android directory.

Gotcha #2: Paths (and names) matter, especially if they contain spaces or special characters (or if environment variables have an unneeded trailing '\')
Solution: The PhoneGap wiki mentions the work-around in numerous places, but I found it easiest to install key components to C:\ (the root) rather than deal with the hassles caused by paths with spaces in the names (ie, C:\Program Files\…). Thus,

  1. When running the Android SDK installer, change the install folder to:

    C:\android-sdk-windows

  2. Extract or move the Apache ANT directory to the root (e.g., c:\apache-ant-1.8.1)
  3. Change to the root of the C: drive when you are ready to:

    git clone https://github.com/phonegap/phonegap-android.git

  4. Really make sure all the environment variables are set properly— proper names, proper distinctions use of User and System Environment variables, and proper syntax (e.g., no trailing '\').
  5. When you are ready to

    droidgap gen projectname

    do NOT use hyphens, spaces or underscores in the project name… weird things will happen as the ruby scripts don't quote the names and also rely on some implicit naming conventions and use of the underscore.

Gotcha #3: The ADT Plugin requires Eclipse Web Developer Tools, but the basic Eclipse Java IDE doesn't include those.
Solution: After Eclipse is installed, if you picked the basic Eclipse Java IDE you can add the Web Developer Tools as follows:

  1. Launch Eclipse
  2. Use the Eclipse drop-down menu for Help to pick Install New Software…
  3. In the dialog for "Install" use the drop-down list to select "Helios - http://download.eclipse.org/releases/helios". Then scroll down to "Web, XML, and Java EE Development". Expand that item and then check the boxes to add at least Eclipse Web Developer Tools, Eclipse Web Developer Tools, Eclipse XML Editors and Tools, and Javascript Development Tools. The image below may help.
    Eclipse Install New Software dialog
  4. Select "Next" and continue on, accepting the agreements (if you agree).
  5. Be sure to quit and restart Eclipse before Installing the ADT Plugin (see instructions at that link).

Gotcha #4: Environment variables matter. (aka "Gotcha #2 Returns: Paths Redux")
Solution: Make sure you properly set the necessary environment variables and verify them at the command prompt.

Gotcha #5: Proxy settings may be needed and seem to conflict. Settings for msysgit aren't obvious, and seem to interfere with Eclipse proxy settings (creating "msysgit proxy misery"). I discovered this one at the workplace yesterday, where using the proxy server is a must.
Solution: The proxy settings for Eclipse are fairly straightforward (eg, use the drop-down menu Window to select Preferences. Then expand the tree control for General and select Network Connections.)

Not-so-obvious are the proxy settings for msysgit, nor is it obvious that they can clash with the Eclipse settings. To set the proxy for msysgit, you use environment variables. I set these using User Environment Variables (see above) and setting the following variables:

HTTP_PROXY=proxyserver.com:portnum
HTTPS_PROXY=proxyserver.com:portnum

Where proxyserver.com is the fully qualified name or IP address of a proxy server and portnum is the active port for said proxy server. After setting those two variables, I was able to successfully clone phonegap-android using this command with the prompt already set to c:\ as the current directory:

git clone https://github.com/phonegap/phonegap-android.git

Unfortunately, I needed to go back, and "un-set" (delete) the User Environment Variables for the proxies in order for Eclipse to work with updates, installs, etc. In hindsight, I might have been able to leave those environment variables in effect and set Eclipse to connect "Natively" or "Directly" without a proxy, instead of removing the variables and using my Eclipse manual proxy settings.

UPDATE:

  1. Errors in Tip about PATH. I left some elements out in the PATH tip above. I updated it and forced a line break for clarity. You may find PhoneGap docs that contradict my tip, but it works well for me as is.
  2. Proxy settings. Earlier today I was able to get Eclipse to work just fine with the HTTP_PROXY environment variables in place and the Eclipse preference for General > Network set to Active Provider "Manual" with proper proxy server address and port values.

Whew. I'm not going to make this even longer. Much of the rest of the installation and usage is relatively well documented elsewhere.

I'll watch comments for feedback on this lengthy post. A follow-up post will address turning a generated phonegap-android project into an Eclipse project. In the interim, I'll likely post something shorter about getting phonegap-iphone going in Xcode.