Thursday 13 January 2011

Setting up PhoneGap for Android on Windows 7

Everything I see shows this on a Mac, so here are my notes on getting up to speed for Windows 7.

Preparation (Reading and Downloading)

Start with the generic Android Eclipse quickstart here: http://wiki.phonegap.com/w/page/30862722/phonegap-android-eclipse-quickstart

It tells you that you need the Android SDK which you download here (this is the start of a veritable download fest):
http://developer.android.com/sdk/index.html (31.2MB)
NB. I recommend the ZIP, not the EXE; you'll see why when you read the installation.

You read the notes and see you should follow the guide to installing the SDK:
http://developer.android.com/sdk/installing.html

You might need the JDK, or a newer version. Download from here:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Note to self: This site expects you to know what edition and version you need rather than telling you or helping you decide. (You need JavaSE dummy.) (66.9MB)

You'll need the IDE as well, and this should be Eclipse Classic. Get it here:
http://www.eclipse.org/downloads/ (170MB)

Installations

Installation order:

  1. JDK (jdk-6u23-windows-x64.exe)
    Unsure of the options, the only thing I skipped installing was the source code. Also installed to D: rather than C: (space). Note that the JRE is actually a 2nd installation kicked off from the former, so you have to change the installation drive again here. Sidenote: Oracle want me to register, and to do that I need to create an account. Just to use Java? No thanks.
  2. Eclipse (eclipse-SDK-3.6.1-win32-x86_64.zip)
  3. Android SDK (installer_r80-windows.exe)
    Even though the JDK has been installed, this installer says it can't find the JDK and progress is blocked. You can't tell it where the JDK is; you can only exit. A reboot doesn't address this issue. I try by copying the entire D:\Program Files\Java\jdk1.6.0_23 to C:\Program Files (x86)\Java\jdk1.6.0_23 with no luck. I then add the bin folder to the PATH environment variable (Computer/Properties/Advanced System Settings/Advanced/Environment Variables.) Still no luck. At this point I give up on the installer and download android-sdk_r08-windows.zip (31.2MB) whilst cursing the installer for it's refusal to cooperate.
    I extract the contents to D:\Dev\android-sdk-windows and run SDK Manager.exe to download the packages I want/need. (I rejected the oldest libraries.)

By now I've done steps 1 and 2 of the SDK installation guide. On to Step 3: Installing the ADT plugin for Eclipse:
http://developer.android.com/sdk/eclipse-adt.html#installing. It's installed through Eclipse, so not a download I could easily measure in size. It's apparently around 8MB if you download it manually. At last we have a step that feels as painless as a typical Windows installation.

I realize at this point that I jumped the gun when I ran the package manager and installed those packages. The installation guide suggests doing that now. Though it's not made any difference - everything seems to work fine now.

Apparently we're done and we can get back to the QuickStart and making that first PhoneGap Android application. Woohoo!