Beginning Android

Jeff Friesen
Jeff Friesen

Beginning Android is a seven-part series that introduces you to Android app development. You learn how to install the necessary development software and also how to build and run your first app. Although theory is kept to a minimum, you learn essential concepts at the appropriate moments. Each lesson ends with a set of questions designed to reinforce your understanding of its content.

Note For a definition of Android and an overview of this technology, I suggest that you examine the “What is Android?” topic in Google’s Android Developer’s Guide. Also, this course was developed on a Windows XP platform, but is generally applicable to Mac OS X and Linux with minor changes.

Install the Android SDK

Google provides the Android SDK to help you get started with app development. The Android SDK provides a directory framework for organizing various components, and also provides basic tools and other items. Lesson 1 shows you how to install the Android SDK by first assessing system requirements. It then focuses on downloading and running the Windows-based Android installer executable.

Assess System Requirements

Before installing the Android SDK, you must find out if your operating system is supported, what additional software must be installed, and how much available disk space will be required.

The SDK supports the following operating systems:

  • Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit)
  • Mac OS X 10.5.8 or later (x86 only)
  • Linux (tested on Ubuntu Linux, Lucid Lynx): GNU C Library (glibc) 2.7 or later is required. On Ubuntu Linux, version 8.04 or later is required. 64-bit distributions must be capable of running 32-bit applications. For information on how to add support for 32-bit applications, see the Ubuntu Linux installation notes.

The SDK requires that Java Development Kit (JDK) 5 or JDK 6 be installed – you cannot use the Gnu Compiler for Java (gcj), which is not supported. If you’ve installed or plan to install JDK 7, keep in mind that you cannot use the try-with-resources language feature because this feature depends upon the java.lang.AutoCloseable interface, which is not supported by Android. You must also install Apache Ant 1.8 or later. This software is used to build Android projects.

The Windows version of the SDK (release 16) requires about 50MB of free disk space for its SDK management and basic tools. Because you will use one of these management tools to add more components to the SDK, and because these components have their own disk space requirements, you must ensure that sufficient disk space is available. The following list identifies these components and their disk space requirements:

  • Android platform: a collection of files that describes a specific version of Android. According to Google, each platform requires 150MB of disk space – newer platforms probably require more space. At least one platform must be installed
  • Platform tools: build tools that are periodically updated to support new Android platform features. For this reason, they are kept separate from the SDK’s basic tools. About 25MB of disk space is required on the Windows platform
  • Add-ons: Google or third-party libraries that extend Android platforms. According to Google, each optional SDK add-on requires 100MB
  • USB driver for Windows: an optional component for transferring files between the development platform and various hardware devices (e.g., Verizon Droid), and that (according to Google) requires 10MB
  • Samples: an optional component that contains example code, and that (according to Google) requires 10MB
  • Documentation: an optional component that contains Android documentation for exploring offline, and that (according to Google) requires 250MB

Download and Run the Windows Android SDK Installer

The Android SDK Download page at Google’s Android Developers website provides access to the SDK. See Figure 1.

Figure 1. Download the Android SDK from the Android Developers website’ s Download page.

You can download the SDK for your Windows, Intel-based Mac OS X, or i386-based Linux platform. If your platform is Windows, you’ll probably find it easier to download the EXE-based installer. I downloaded installer_r16-windows.exe for my Windows XP SP3 platform. Running this installer shows a dialog box with an initial Welcome to the Android SDK Tools Setup Wizard pane.

The following steps complete SDK installation:

  1. Click the Next button to move to the Java SE Development Kit pane.
  2. After reviewing the found JDK that will be used with Android, click the Next button to move to the Choose Install Location pane.
  3. Select an appropriate destination folder or keep the C:Program FilesAndroidandroid-sdk default – I changed the folder to C:android- sdk for convenience. Click the Next button to move to the Choose Start Menu Folder pane.
  4. Select an appropriate Windows Start Menu folder or keep the Android SDK Tools default, and click the Install button to move to the Installing pane.
  5. The Installing pane shows installation progress. After installation finishes, this pane turns into Installation Complete. Click the Next button to move to the Completing the Android SDK Tools Setup Wizard pane.
  6. Uncheck or leave checked the Start SDK Manager checkbox on the Completing the Android SDK Tools Setup Wizard pane. Click Finish.

Following the SDK’s installation, the android-sdk home directory contains the following directories and files:

  • add-ons: This initially empty directory stores Google APIs and other add-ons from Google and other vendors.
  • AVD Manager.exe: This tool is used to manage Android virtual devices (device configurations that are run with the Android emulator).
  • platforms: This initially empty directory stores Android platforms in separate subdirectories. For example, Android 2.2 would be stored in one subdirectory, whereas Android 3.2 would be stored in another subdirectory.
  • SDK Manager.exe: This tool is used to manage the Android SDK (e.g., add a new platform or other component).
  • SDK Readme.txt introduces you to the Android SDK and tells you that, in order to start developing apps, you need to use SDK Manager to install platform tools and at least one Android platform version.
  • tools: This directory stores platform-independent tools. For example, tools stores emulator.exe, which is an application that launches the Android emulator with a specific device configuration.
  • uninstall.exe: This tool is used to uninstall the Android SDK.

As well as emulator.exe, you’ll find sqlite3 (manage SQLite databases that are created by Android apps), zipalign (optimize Android PacKage [APK] archive alignment), and other tools directory tools to be useful.

After installing the Android SDK, consider adding the absolute path of android-sdk and the absolute path of android-sdktools to your platform’s PATH environment variable. That way, you can conveniently execute AVD Manager, SDK Manager, and the other basic tools from anywhere in your filesystem, which is especially helpful should you want to develop Android apps at the command line.

Review Questions

The following review questions help you test your mastery of Lesson 1’s material:

  • What is the Android SDK?
  • What operating systems are supported by the SDK?
  • What JDK versions are supported?
  • You cannot use Java 7’s try-with-resources language feature when writing an app. Why?
  • Identify the various components that can be added to the SDK.
  • Following the SDK’s installation, what is the default name of Android’s home
    directory? What directories and files are stored in this directory?