This guide describes how to install the Android developer environment.

What you’ll build

You’ll learn how to install the tools needed to build Android applications. If necessary, you’ll create an Android virtual device (AVD).

What you’ll need

  • About 15 minutes

  • A favorite text editor or IDE

  • JDK 7 or later

Set up the Android development environment

Before you can build Android applications, you must install the Android SDK. Installing the Android SDK also installs the AVD Manager, a graphical user interface for creating and managing Android Virtual Devices (AVDs).

  1. From the Android web site, download the correct version of the Android SDK for your operating system.

  2. Unzip the archive to a location of your choosing. For example, on Linux or Mac, you can place it in the root of your user directory. See the Android Developers web site for additional installation details.

  3. Configure the ANDROID_HOME environment variable based on the location of the Android SDK. Additionally, consider adding ANDROID_HOME/tools, and ANDROID_HOME/platform-tools to your PATH.

Mac OS X
export ANDROID_HOME=/<installation location>/android-sdk-macosx
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export ANDROID_HOME=/<installation location>/android-sdk-linux
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
set ANDROID_HOME=C:\<installation location>\android-sdk-windows
set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools

The Android SDK download does not include specific Android platforms. To run the code in this guide, you need to download and install the latest SDK platform. You do this by using the Android SDK and AVD Manager that you installed in the previous section.

1. Open the Android SDK Manager window:

If this command does not open the Android SDK Manager, then your path is not configured correctly.

2. Select the Tools checkbox.

3. Select the checkbox for the latest Android SDK.

4. From the Extras folder, select the checkbox for the Android Support Library.

5. Click the Install packages…​ button to complete the download and installation.

You may want to install all the available updates, but be aware it will take longer, as each API level is a large download.

If necessary, create an Android virtual device

If you do not have an Android device for testing, you can use an Android virtual device.To do this, you must first install the Android SDK and install the corresponding SDK platforms and packages. See Set up the Android development environment.

This command creates a new AVD named "Default" that is based on Android 5.1, API Level 22:

android create avd --name Default --target android-22 --abi armeabi-v7a

Press enter when prompted to create a custom hardware profile.

Android 5.1 is a basic Android platform.
Do you wish to create a custom hardware profile [no]

The AVD is created and the details are displayed.

Created AVD 'Default' based on Android 5.1, ARM (armeabi-v7a) processor,
with the following hardware config:

As an alternative you may also use the android GUI tool to create an AVD.

Here is more information about some of the parameters used:

  • --name Name of the new AVD.

  • --target Target ID of the new AVD.

  • --abi The CPU/ABI to use for the AVD.

This command displays a list of available targets. Use these targets to create different AVDs based on different Android versions as appropriate.

android list target

You can see that the target value of "android-22" is associated with Android 5.1. Note the ABIs (CPUs) available for this target ID. The command used earlier to create the AVD specified an ARM CPU.

       id: 19 or "android-22"
     Name: Android 5.1
     Type: Platform
API level: 22
 Revision: 1
    Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : android-tv/armeabi-v7a, android-tv/x86, default/armeabi-v7a, default/x86, default/x86_64

View the list of available AVDs with this command:

android list avd

Here is the AVD that was just created:

    Name: Default
    Path: /Users/{user}/.android/avd/Default.avd
  Target: Android 5.1 (API level 22)
 Tag/ABI: default/armeabi-v7a
    Skin: WVGA800

Verify that the AVD is working:

emulator -avd Default


Congratulations! You have just installed the Android development environment, which can be used with Spring.