This summer I will be developing an Android app with James, who is also a senior CS major at Worcester State. Neither of us have ever done anything like this, so needless to say it will be an adventure. The first thing I had to do was to properly set up my development environment. Google has a guide here, but it wasn’t the smoothest process. There was a bit of trial and error along the way. I have a fairly modern computer running Windows 7 64-bit. Here’s my rundown of setting everything up:
Step one was to install the JDK, Java Development Kit. That was easy enough. Oracle’s website has lots of options, so it was important to choose the standard 32-bit JDK installer. Even though I have a 64-bit system, I chose 32-bit in order to maximize compatibility.
Step two was to install the Android SDK. Once that has been installed, running the SDK Manager lets you choose what Android platforms to download. For now, I only downloaded the latest version, 4.0.3/API15.
Next was to install Eclipse. Eclipse.org has a lot of options. I opted for Eclipse for Java Developers 32-bit (matching my 32-bit JDK), though I hear Eclipse Classic works too. There is no installer exe for Eclipse, only a zip file, which might confuse Windows users. You just need to extract the zip file into your JDK directory, and that’s it. In my case, Eclipse ended up in “C:\Program Files (x86)\Java\jdk1.7.0_04\eclipse”. Then you run eclipse.exe from that folder and off you go.
Inside Eclipse, the next step is to install the ADT plugin, which will integrate several Android tools into Eclipse. This is where things started getting a little hairy. According to the Google guide, Eclipse should be able to grab the tools from a repository located here: “https://dl-ssl.google.com/android/eclipse/”. Eclipse did that, then proceeded to tell me that the tools couldn’t be installed. After a lot of searching, I didn’t find a fix, but I learned the problem possibly has to do with the fact that I am using a newer version of Eclipse (Indigo) than when the guide was written (Helios). Thankfully, Google offers a manual download of the tools here, so I was finally able to get the ADT plugin up and running.
Now that the Android SDK and Eclipse were both configured, it was time to write a program! The Google guide has a very nice-looking series of tutorials, starting with a Hello World app. The first thing to do was to make an AVD (Android Virtual Device), an Android phone emulator. This went smoothly. So did creating the new project, and writing up the simple code. Now to run my very first Android program…
FAIL. In the console, in bright red, I see the message “PANIC: Could not open: C:\Users\Jon\.android/avd/my_avd.ini”. What is this?? Why can’t it find my emulator??? I check, and sure enough, there is no .android folder in my Jon directory. The .android folder is on the root of my D:\ drive, and the AVD is in there. So why is Eclipse looking in my user folder, and how can I fix it? After a lot of searching, I found my answers here. It turns out that this is an ADT bug, and to fix it, I had to make a symbolic link between the two locations. So, in a Windows command prompt, I ran:
mklink /J “C:\Users\Jon\.android” “D:\.android”
An .android folder showed up inside my user directory, identical to the one in D:\. It’s important to note that if I ever want to delete this link, I need to run rmdir rather than just delete the folder. Otherwise, Windows will delete both locations instead of just the symbolic link. I went back to Eclipse and tried running my program again, and it worked! I’ve never been so happy to see “Hello World” appear on my screen.