Android development with Eclipse

The Android logo The Android platform is rising in popularity, and you will not only be able to develop for the Android phones, but also for tablets and other kinds of hardware, such as the Arduino. So development for Android devices is definitely something you’ll want to have in your skillset.

So how do you start? First, you will absolutely need the Android SDK. While you can start Android projects in console with the ./tools/android command-line tool, I recommend starting with an IDE, such as Eclipse.

Unpack the Android SDK you downloaded, into an Android specific project directory. Mine is ~/Documents/Projects/Android. After unpacking, it would be good to make a symlink to the ./tools/android binary from your ~/bin directory (create it if you don’t have it yet, and make sure it is added to your PATH environment variable – very useful). Then run it to open the SDK manager and prepare your SDK environment. If you want to use the latest Android technology, install the latest API, but if you want your applications to be available to 90% of the Android users in the world who are still running Froyo (2.2.x) or Gingerbread (2.3.x), take those as well. Accept the licence agreements, and it should download and install the packages for you – might take a while (2.8GB on my setup – with APIs 10, 15 and 16).

EclipseWhile it is downloading and installing, let’s get Eclipse installed, if you haven’t yet. If you are running a package-based Linux system, then you probably have it in your repositories, but it doesn’t hurt to download an Eclipse package and install it in /opt for example. This way, you’ll also be sure to have the latest package available from the Eclipse website. I don’t need the Java EE stuff, so I got the Eclipse Classic, and installed it in /opt/eclipse. By the way, you need to have a JDK version installed, and on my Ubuntu system I used openjdk-7-jre.

This time, you might want to make it available to other users as well, so make a symlink to the ./eclipse binary from /usr/local/bin. This is optional though. Also add a menu item in your desktop environment, using the ./icon.xpm file as your icon, so you can quickly start up Eclipse from your menu.

You want to keep your Eclipse up to date, so it is good to add its updates repository. My release is Juno (Eclipse 4.2.0), so I need the Juno repository. Under “Help”, go to “Install New Software”, and add http://download.eclipse.org/releases/juno/. Get the latest updates from this repository.

Next, check if your Android SDK has finished installing. If so, add the Android ADT plugin for Eclipse using the same “Install New Software” screen. Enter https://dl-ssl.google.com/android/eclipse/ as the repository. As it is installed, it will ask you for the location of your Android SDK, so tell Eclipse about it.

Android project in Eclipse
Now that everything is installed and ready, your Eclipse knows how to make and manage Android projects. Open a new project, and you will see “Android” listed. Try out some Android training!

With many thanks to Adam Outler’s video tutorial!

What are your thoughts?