Setting up the Android Development Environment
We will be using the Android Software Development Kit (SDK) that comes pre-packaged with
Eclipse, a full-featured Integrated Development Environment (IDE) which we will use to write
and run our Android applications. Follow the three steps below to set up your system. Only Step
1 is platform dependent, Steps 2 & 3 are designed for any of the 3 major systems
(Windows/Linux/Mac OS X).
1. Install Java 6 JDK
Windows/Linux :
Download the installer appropriate for your system from the following web page:
● http://www.oracle.com/technetwork/java/javase/downloads/jdk6u38-downloads-
1877406.html
Max OS X (10.7):
Your system may already have a JDK installed. To determine if you have a JDK installed, open
Terminal and run the command ‘javac’. If you do not have a JDK installed, a prompt will pop
up asking if you wish to install one (do so). If you do have a JDK installed, the help prompt for
the javac program will be displayed. See Figure 1 in the Appendix (page 8).
2. Install Android SDK
Click the “Download the SDK” button from the following link to download the SDK:
● Windows/Mac OS X/Linux: http://developer.android.com/sdk/index.html
After downloading the file, extract/unzip it to wherever you like. The IDE we will be using to write
Android applications is called Eclipse, and is located in the adt-bundle-.../eclipse/
directory (where adt-bundle-... is the directory where you unzipped the Android SDK file).
3. Install the ADT Plugin for Eclipse
Follow the steps outlined in the following link:
● Windows/Mac OS X/Linux: http://developer.android.com/sdk/installing/installing-adt.html
1
Testing the Environment:
To test the setup, we will create and run a simple Hello World application.
1. Create a new Android Application:
File > New > Android Application, fill in a name and continue hitting ‘Next‘ and then ‘Finish’
2
2. A Hello World program will be created for you now by default. To build and run the program,
click the ‘Run’ button (see below).
3
3. You will now be asked to select which device to program. Click the ‘Manager’ button to open
up the Device Manager. We will use the Device Manager to configure an emulator which we will
use to run the Android application.
4
4. In the window that appears, click the ‘New’ button on the right-hand side. A new window will
open, asking you to configure the emulator. Configure the device as shown in the image below.
When you are finished configuring it, hit ‘OK’.
5
5. Close the remaining windows until you see the window named ‘Android Device Chooser’ (see
image below). After hitting the ‘Refresh’ button, you should be able to select your newly-created
emulator for running the application. Select the device and hit ‘OK’.
6
6. The emulator will now launch and boot up (this will take a few minutes depending on the
speed of your machine). After booting up, it will launch the Hello World application we just
created:
If the emulator takes a very long time to boot (if your machine is as old as mine), running the
program may fail (you will see an error message in red in the console, regarding failure to load
the emulator). This is OK, just close the emulator, and re-run the program. Once the emulator
boots up, you can interact with it like a real Android device, and run the application directly by
opening up the device’s list of apps and clicking on the one with the Android icon called ‘test’ (if
you named the application “test”).
7
Appendix
Checking if you have a JDK installed in Mac OS X 10.7 :