Login     Sign Up
Cyril Sermon (@admin)
10 months ago

The Android SDK is completely open. There’s no cost to download and use the API, and Google doesn’t charge to allow distribution of your finished programs. You can download the latest version of the SDK for your development platform from the Android development home page at


Unless otherwise noted, the version of the Android SDK used for writing this book was version 1.0 r1.

The SDK is presented as a ZIP file containing the API libraries, developer tools, documentation, and several sample applications and API demos that highlight the use of particular API features. Install it by unzipping the SDK into a new folder. (Take note of this location, as you’ll need it later.)

The examples and step-by-step instructions provided are targeted at developers using Eclipse with the Android Developer Tool (ADT) plug-in. Neither is required, though — you can use any text editor or Java IDE you’re comfortable with and use the developer tools in the SDK to compile, test, and debug the code snippets and sample applications.

If you’re planning to use them, the next sections explain how to set up Eclipse and the ADT plug-in as your Android development environment. Later in the chapter, we’ll also take a closer look at the devel-oper tools that come with the SDK, so if you’d prefer to develop without using Eclipse or the ADT plug-in, you’ll particularly want to check that out.

The examples included in the SDK are well documented and are an excellent source for full, working examples of applications written for Android. Once you’ve finished setting up your development envi-ronment, it’s worth going through them.

Developing with Eclipse

Using Eclipse with the ADT plug-in for your Android development offers some significant advantages.

Eclipse is an open source IDE (integrated development environment) particularly popular for Java devel-opment. It’s available to download for each of the development platforms supported by Android (Win-dows, Mac OS, and Linux) from the Eclipse foundation homepage:


There are many variations available when selecting your Eclipse download; the following is the recom-mended configuration for Android:

❑Eclipse 3.3, 3.4 (Ganymede) ❑ Eclipse JDT plug-in ❑ WST

WST and the JDT plug-in are included in most Eclipse IDE packages.

Installing Eclipse consists of uncompressing the download into a new folder. When that’s done, run the Eclipse executable. When it starts for the first time, create a new workspace for your Android development.

Using the Eclipse Plug-in

The ADT plug-in for Eclipse simplifies your Android development by integrating the developer tools, including the emulator and .class-to-.dex converter, directly into the IDE. While you don’t have to use the ADT plug-in, it does make creating, testing, and debugging your applications faster and easier.

The ADT plug-in integrates the following into Eclipse:

❑An Android Project Wizard that simplifies creating new projects and includes a basic applica-tion template

❑Forms-based manifest, layout, and resource editors to help create, edit, and validate your XML resources

❑Automated building of Android projects, conversion to Android executables (.dex), packaging to package files (.apk), and installation of packages onto Dalvik virtual machines

❑The Android Emulator, including control of the emulator’s appearance, network connection set-tings, and the ability to simulate incoming calls and SMS messages

❑The Dalvik Debug Monitoring Service (DDMS), which includes port forwarding; stack, heap, and thread viewing; process details; and screen capture facilities

❑Access to the device or emulator’s filesystem, allowing you to navigate the folder tree and trans-fer files

❑ Runtime debugging, so you can set breakpoints and view call stacks

❑ All Android/Dalvik log and console outputs

Figure 2-1 shows the DDMS perspective within Eclipse with the ADT plug-in installed.