Install Eclipse and the Android ADT

You don’t write an Android app on your Android phone—you would go blind. You write the app on an Intel Macintosh, Windows PC, or Linux host, using an application called Eclipse. To install Eclipse and everything else you’ll need for this course, follow the instructions in Setting Up the ADT Bundle. ADT stands for Android Developer Tools; it is a plugin that plugs into Eclipse. The following is details about the instructions.

Install the Java JDK

An Android app is written in the language Java, so you’ll need the JDK (Java Development Kit) on your computer. Maybe you already have it.

JDK for Mac

To verify that the JDK is already installed on your Mac, launch the application Java and select General. The installed Java Platforms are listed under General, with names like JAVA SE 6, JAVA SE, or J2SE. Each platform contains a JDK.

JDK for Windows

See if the Java SDK is already installed on your PC.

  1. On Windows 7,
    start → Control Panel → Programs → Programs and Features

  2. On Windows XP,
    start → Settings → Control Panel → Add or Remove Programs

  3. On Windows Vista,
    start button → Control Panel → Programs → Programs and Features

You should see files such as the following, which contain the JDK.

  1. Java(TM) 7
  2. Java(TM) SE Development Kit 7

If your Windows PC does not have the Java JDK, download “Java SE Development Kit 7”. Press the big square button that says “Download Java Platform (JDK) 7u21”. Download one of the windows files and run it. (On my Windows 7 I chose the file for Windows x86.) Accept the defaults. (For example, the destination folder on Windows Vista was C:\Program Files (x86)\Java\jre7\.) Add or Remove Programs should now list the Java items shown above.

JDK for Linux

My pristine, freshly downloaed Fedora 18 Desktop Edition already had Java:

yum list | grep jdk | more

/usr/bin/java -version
java version "1.7.0_09-icedtea"
OpenJDK Runtime Environment (fedora-2.3.3.fc18.1-x86_64)
OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)

JDK command line programs

If the JDK is installed, you should have two command line programs named keytool and jarsigner Make sure you have them. On Mac or Linux, try to find them with which. If that doesn’t work, try to find them with find.

which keytool
find / -type f -name keytool -print 2> /dev/null
man -k keytool jarsigner
keytool(1)               - key and certificate management tool
jarsigner(1)             - JAR signing and verification tool
man keytool

On Windows 7 or Windows Vista, open the black Command Prompt window by launching cmd.exe. Type the following commands into this window. The 'single quotes' are needed because the name of the Program Files (x86) directory contains a blank.

cd 'C:\Program Files (x86)\Java\jdk1.7.0\bin'
dir keytool.exe jarsigner.exe
keytool.exe -help
jarsigner.exe -help

Other command line programs will be javadoc.exe and Apache ant (Another Neat Tool).

Install Eclipse Juno and its ADT plugin on Mac, Windows, Linux

Android is 32-bit but my Fedora Linux is 64-bit. I had to install the following 32-bit packages. See the Fedora website.

yum install glibc.i686 glibc-devel.i686 libstdc++.i686 zlib-devel.i686 \
ncurses-devel.i686 libX11-devel.i686 libXrender.i686 libXrandr.i686 \

cd /usr/lib
ln -s libGL

The current release of Eclipse is named Juno. To download Eclipse Juno and the Android ADT, press the big blue button on the right at On Mac, this downloads a zip file named adt-bundle-mac-x86_64-20131030. On Microsoft Windows, it downloads adt-bundle-windows-x86_64-20131030. If the big blue button can't identify your computer, it will say “Choose the SDK package for your OS from the table below.” For my Fedora Linux, I selected

Double-click on the file to create a folder named adt-bundle-mac-x86_64-20131030. Move this folder wherever you want. For example, I created a Development folder under my home directory

mkdir Development
chmod 755 Development
ls -ld Development
and moved adt-bundle-mac-x86_64-20131030 there. You can now throw away the big .zip file that you downloaded.

Open the folder adt-bundle-mac-x86_64-20131030. In it, open the folder eclipse and look for the application Eclipse. (On Microsoft Windows, it’s eclipse.exe.) Its icon is a green circle with {curly braces} on Macintosh, a purple disk on Microsoft Windows, and a purple tilted square on Linux.

Set your PATH environment variable

A directory is the same thing as a folder. The directories ~/Development/adt-bundle-mac-x86_64-20131030/sdk/tools and platform-tools contain command line programs such as android and ant. (The tilde ~ stands for the name of your home directory.) Put the names of these directories into the list of folder names in your PATH environment variable. The \012 is the octal character code of a newline.

echo $PATH | tr : '\012'
export PATH=$PATH:\
echo $PATH | tr : '\012'
which android
which adb

Launch Eclipse

Choose the default workspace folder that it offers you.

Workspace Launcher
Select a workspace
ADT stores your projects in a folder called a workspace.
Choose a workspace folder to use for this sesssion.
Workspace: /Users/myname/Documents/workspace (Macintosh OS X)
           C:\Users\myname\workspace         (Microsoft Windows 7)
           /home/myname/workspace            (Fedora 18 Linux)
Contribute Usage Statistics?
• No

Minimize the Welcome! window by pressing its minimize bar in the upper right corner.

On Windows, right-click on the file you downloaded and select Extract All…. On Windows 7, I left the resulting eclipse-jee-indigo-win32-x86_64 directory in C:\Users\Myname\Downloads. On Windows Vista, I left the resulting eclipse directory in the AppData\Local subdirectory of my home directory.

On Linux, download the .tar.gz file. I placed the resulting eclipse directory (and later, the android-sdk-linux_x86 directory) in the Downloads subdirectory of my home directory.

Create an AVD (Android Virtual Device)

An AVD looks like an Android phone or tablet when you see it on the computer’s screen. You’ll need at least one of them to run your app on your computer.

In Eclipse, select
Window → Android Virtual Device Manager.
Select Android Virtual Devices and press New….

Create new Android Virtual Device (AVD)
AVD Name: WVGA (or whatever you want)
Device: 3.7" WVGA (480 × 800: hdpi)

Fedora Linux: the Android Virtual Device Manager window had no dismiss box, so I had to right-click on it and select Close.

To verify that an AVD named avd has been created,

ls -ld ~/.android/avd/avd.*

Install the Documentation for the Android SDK

You don’t have to download the documentation: it’s online at But you can download it if you want to. In Eclipse, select
Window → Android SDK Manager.
This manager will let you install documentation, older versions of Android, various extras, etc.

Under Android 4.2.2 (API 17), check Documentation for Android SDK. Press the button that says Install 1 package….
Select the following.

? Documentation for Android SDK
• Accept
Done loading packages.
ls -l /Users/myname/Development/adt-bundle-mac-x86_64-20131030/sdk/docs/index.html

Point your browser at
Develop → Training → Building Your First App

Later, we’ll also install the samples.

All done

If you wish, you can now exit from Eclipse.