Thursday, June 10, 2010

Android, Eclipse, and Windows 7 x64

I'm diving into Android development these days. While the platform shows a lot of promise and provides many compelling features, I had a few speed bumps getting started with Android development in Eclipse, the predominant IDE. I had a fairly recent version (dated Dec. 2009, I believe) of Eclipse Galileo installed from a previous project to which I wanted to add the Android SDK and plugin. My initial installation attempt was not successful--while the SDK installed properly and would load the Android SDK and AVD Manager, and the plugin itself also reported a successful installation, there was no evidence of Eclipse knowing anything about Android--there were no project templates, samples, or preferences.

Thinking that this was due to the age of my Eclipse installation, I renamed the Eclipse installation folder and fetched a fresh download of the latest version. My second installation attempt appeared to work with the new copy; the Android plugin registered properly this time and I was able to create and debug projects. Then I tried to install a second plugin--the Team Explorer Everywhere 2010 plugin for Eclipse--and voila, not only did all of the Android bits vanish, but the TFS plugin didn't register either.

I started looking at my folder locations. My workstation is a Windows 7 x64 with UAC enabled. Eclipse was deployed to C:\Program Files (x86)\Eclipse, and I had dropped the Android SDK folder into C:\Program Files (x86)\Eclipse\android-sdk-windows ("put it anywhere," I thought...). I had a suspicion that UAC was interfering with Eclipse's plugin management, so I moved the entire Eclipse installation folder including the Android bits to my user folder, adjusted the Android Eclipse plugin setting and system path entry for the SDK location, and tried again. This time, I was able to get the Android plugin to function, but when I tried to create projects from the Android samples, I got access control errors on the .project file of anything I tried to open.

In the end, the following cookbook worked:
  • Eclipse installed to %USERPROFILE%\Documents\eclipse
  • Android SDK installed to %USERPROFILE%\Documents\android-sdk-windows and set up in that location (ran the tool to download all of the SDK components directly there)
  • Plugins installed in Eclipse via the standard method (Help | Install New Software)
After doing this, all of the plugins played nicely with each other, and I no longer got warnings creating the Android sample projects.

No comments:

Post a Comment