Intro to Memtech: Java - Setting up your Android environment

Last time we went over the spectrum of use cases for Java as well as took a glance at the variety of web frameworks available for the JVM. That's great for self-exploration, but what else do I have to show you about Java?

While web application frameworks obviously have a lot to say (in a lot of different ways), Java's role in the mobile space (in my opinion) is more compelling. While Java has been in the mobile space for a while, the popularization of the Android OS by Google has really changed the landscape. Android runs a Java compatible virtual machine called Dalvik. If you've been following along so far in this post series, you already have 2 of the 3 downloads needed to develop on Android, namely the JDK and Eclipse.

Go to developer.android.com and download the Android SDK or Software Development Kit. Windows gets a nifty installer which fires off a separate download for the Android SDK Tools. On other systems you'll need to refer to the documentation to fire off that download from the Android SDK and AVD Manager utility. Refer to the documentation for the Android SDK setup while those download to get your bearings. The next step is to get the Android Development Tool or ADT Plugin for Eclipse (remember that readily supported plugin architecture?).

You can follow the directions linked above but note that there is currently a bug in the ADT plugin that causes the emulator to fail to launch if the SDK location contains any spaces (by default in Windows 7 it will be in the "Program Files" directory). When firing up Eclipse you can use the default workspace. After completing the ADT Plugin installation, you'll still need to setup an AVD or Android Virtual Device, a kind of system image for the emulator. You can reach the Android SDK and AVD Manager utility now from your OS (Start menu in Windows 7) or from within Eclipse under "Window -> Android SDK and AVD Manager". Follow the directions in the last link, but I suggest you use SDK 2.1 as that will let you reach a high percentage of devices (unless you're making an app for a tablet, for which I suggest the 3.x branch).

The instructions for setting up an AVD end by landing you squarely in midst of a Android "Hello,World" style example, which I suggest you finish to test your setup. When you finish you should be able to create a new Android project in Eclipse and successfully get the "Hello, World" app to run within the emulator. In my next post, I'll start digging into the syntax of Java so you can make sense of the app you've brought to life.