Developing Android Applications Part 2: The Tools You’ll Need


Okay this quick article is just about how to get your system set up to develop Android applications. There is already a really good guide on the Android site, and that’ll show you everything you need to know. The only difference here is that I will go into a bit
more detail and I will focus this detail on someone installing under the Windows environment.

Won’t lie, this will be a bit of a trek for you, but it’ll be worth it and by the end you’ll have an Android ready system 🙂

The only other caviat is that these sorts of guides have a bit of a shelf life. They rely on links still working, and websites still looking the same. This was written on the 25th of September 2010: apologies if you are reading this in 2054 and none of this is relevant any more (although, if that is the case, leave a comment and if I’m still alive I’ll help you through the setup). For the remainder of this article, the words “At time of writing” will be replaced by the acronym “ATOR” 🙂


The basic shopping list

You’re going to have to do a bit of downloading, from several places, in order to get your environment set up. We’ll go through these one at a time here, but before we start here’s the list. Although older versions of each of these are supported (and by the time you read this, these versions may BE the old versions!) below are the versions I will be using;

  • The JDK (version 5 or above are supported, this guide will be using JDK6)
  • The Eclipse IDE (various flavours supported, this guide will be using Eclipse for Java Developers)
  • The android SDK (current newest version is 2.2)
  • The Android Development Tools plugin for Eclipse (hereonin referred to as the ADT plugin)

The JDK

a.k.a the “Java Development Toolkit”. This should be music to the ears of any C# developers out there: unlike iOS (the iphone platform) Android is a java based platform, meaning a very modern and intuitive OO syntax (“dot notation” is no loger a ‘feature’, it’s the law!). The JDK is dead easy to set up, if you haven’t got it already installed on your machine, here’s how to do it; The first place you need to head on over to is the Sun Microsystems website, then head to the downloads section. ATOR this URL is as follows;

http://www.oracle.com/technetwork/java/javase/downloads/index.html

Which takes you to a page which has various download options like this;

You’ll need the one on the far left, the “Java platform JDK”. If the screen has changed by the time you read this, just go for the one that most closely matches this. Anyway, download the file and run the installation package.

Once it’s installed, there is one extra step you’ll want to take. There are two important assemblies included within the JDK distribution that you’ll be using quite a lot (although, you probably won’t know you’re using them if you’re developing in Eclipse). These are called “javac” and “java”. Basically the first is to compile java source files, the second is to run java class files. You want to therefore add these to your PATH environment variable. In the good ol’ days this would have meant editing the autoexex.bat file, but in more modern versions of Windows this is all done through a GUI. These are the Vista/Windows 7 instructions;

  1. Click the start button
  2. Right click “Computer” and select “Properties”
  3. Click “Advanced System Settings
  4. Click “Environment variables”
  5. Find the “Path” variable in the “System variables” window, or add it if it isn’t there.
  6. Path variable should have the path to the “bin” folder in the directory you installed the JDK to. In my case it was “E:\Java\JDK\bin” (if you’ve never edited this before: DONT delete things that are there already, just tack the new path on the end after a semi colon)

And you’re done. You can check if it’s worked by firing up a command prompt and typing the word “javac”. If you are shown all of the correct usage for that command, it means that the JDK is installed correctly. If not, it means you messed up (or that this guide is too old and you’re going to need to google it).


The Eclipse IDE

You don’t have to use Eclipse, but I would strongly reccomend it. Not only is it a very good IDE in its own right, with distributions accross all major operating systems, but the team at Google have also developed an Android plugin for it which makes life much, much easier. Installation is very simple, ATOR the eclipse download page is at the following address;

http://www.eclipse.org/downloads/

A few of the flavours will work, but we’ll be using “Eclipse IDE for Java Developers”, which is 99MB in size. Download the package and unpack it and you’re done.


Install the ADT plugin

This will install a plugin which includes various android related enhancements to the Eclipse IDE. Installation is very simple: fire up Eclipse and on the “Help” menu, select the option “Install new software”. In the “Work With” text area at the top, enter the following address;

https://dl-ssl.google.com/android/eclipse/

and after a few moments you should see “developer tools” appear in the central window. Tick the checkbox next to this, and hit “Finish” to install the plugin. Your’e done!


The android SDK

Next we’ll install the Android SDK. You download this direct from the android website;

http://developer.android.com/sdk/index.html

Once it’s downloaded and installed, head back to the “Path” environment variable (where you put the location of the JDK, see above step) and add a new path to that variable: This time though, add a path to the location of the “tools” folder in the android SDK installation directory.

Next, browse to the installation directory and fire up the SDK manager (which will be in the installation directory);

or just fire up a command prompt and type “Android”; Either way, eventually you’ll be presented with the manager window. First, select “Available packages” on the left and you’ll be presented with a list of SDK’s, API’s and other things. For now, just select the newest SDK platform and the newest API. Samples are also available to download from here if you want to download other examples.

Before you close the manager, we also want to create an Android Virtual Device. This will essentially be an emulation of a device running the Android OS, and is also very easy to set up. Select “Virtual Devices” from the left panel, Click “New”, give it a name (I called mine “Mikeys_AVD” but you can go for whatever works for you) and select the Target from the dropdown (the target will probably differ by the time you read this, but right now it’s android 2.2). Ignore the rest and just click “Create AVD”.


And you’re done!

That’s it, your system is now set up to develop applications for the Android platform. In the next part I’m going to go through the various parts of the android development environment as well as looking at the bits that go together to make up an application. In the meantime, if you want to get started coding or simply want to make sure that you’ve installed everything correctly, there are some excellent tutorials over at the android website, I’d suggest you start there!

Android ‘hello world’ <– Start here!

plus, two articles in one day! I expect these will from now on become weekly things, but for now I’m enjoying myself so you get two 😀

Leave a comment