Installing the Android SDK
Edit

Installing the Android SDK

Overview

This guide describes where to obtain and how to install the Google Android SDK and associated packages.

Compatibility and Download

Titanium requires the Android SDK Tools to be installed in order to allow you to develop Android applications.

Remember that Oracle JDK is a prerequisite for Android development and should be installed first. See Installing Oracle JDK for instructions.

images/download/attachments/29004836/download_05.png

The Android SDK Manager installer may be obtained from the Official Website.

Required Android Packages

The following packages, and the respective versions shown, must be installed to be able to develop for Android:

Package

Version

Android SDK Tools

Rev 23

Android SDK Platform-tools/Build-tools

Rev 21 (Rev 19.0.3 and later requires Titanium SDK 3.2.2 or later.)

Android SDK

  • For Release 3.2.0 and later, you need to have at least one Android SDK installed within the supported minimum and maximum target versions.

  • For Release 3.1.x and prior, you need to have the minimum supported Android SDK installed.

  • For Android modules, you need to install Android SDK 2.3.x (API level 10).

See section below for the range of supported SDKs.

If you are using Titanium SDK 3.1.0 and earlier, Android SDK Tools r22 may break your Android builds as described in TIMOB-13944. To workaround this issue, either:

  • Create symlinks between the old and new locations of the test tools:

    cd /Applications/Android-sdk/platform-tools
    ln -s /Applications/Android-sdk/build-tools/17.0.0/aapt aapt
    ln -s /Applications/Android-sdk/build-tools/17.0.0/dx dx

Take caution before upgrading these packages, as changes to the way they work has broken the Titanium toolchain a number of times in the past. Although these problems are often beyond our control, we always do our utmost to fix them as soon as we are made aware of them.

With this in mind, it's important to only upgrade these packages between major projects, so that you have time to fix any problems that may result. Always consult the Android Tools Release Notes and Known Issues first, and refer to our Installation Troubleshooting guide to check whether there are any further actions that need to be taken to make the Titanium and the Android SDK compatible.

Android SDK / Target Android Platform

Each Titanium SDK supports building against a specific range of Android versions, as shown in the following table, and requires at least one of these versions to be installed. If you specify a android:targetSDKVersion in the tiapp.xml file of your project, you must specify one within the target min and max values. The minimum Android/SDK version column indicates the minimum version of Android that a device can run, which a Titanium application supports.

For Release 3.1.x and prior, the minimum target Android API level must be installed to use the Titanium SDK. The Titanium SDK will not work with Android SDKs earlier than the minimum Android SDK version. The maximum SDK version in the table below represents the maximum Android SDK version that the Titanium SDK was tested against.

Titanium SDK Version

Min Target Android/SDK Version
(android:targetSdkVersion)

Max Target Android/SDK Version
(android:targetSdkVersion)

Minimum Android/SDK Version
(android:minSdkVersion)

3.4.1 - latest

4.0.x (API 14)*

5.0.x (API 21)**

2.3.x (API 10)

3.3.0 - 3.4.0

4.0.x (API 14)*

4.4.x (API 19)

2.3.x (API 10)

3.2.0 - 3.2.3

2.3.x (API 10)*

4.4.x (API 19)

2.3.x (API 10)

3.1.2 - 3.1.3

2.3.x (API 10)

4.3.x (API 18)

2.3.x (API 10)

3.1.1

2.3.x (API 10)

4.2.x (API 17)

2.3.x (API 10)

3.1.0

2.2 (API 8)

4.2.x (API 17)

2.2 (API 8)

2.1.2 - 3.0.2

2.2 (API 8)

4.1.x (API 16)

2.2 (API 8)

2.0 - 2.1.1

2.2 (API 8)

4.0.x (API 15)

2.2 (API 8)

1.8.x

2.2 (API 8)

3.x.x (API 11)

2.2 (API 8)

1.7.x

2.1 (API 7)

3.x.x (API 11)

2.1 (API 7)

Notes

(*) If you are building an Android module, you need to have Android SDK 2.3.x (API level 10) installed.

(**) The Titanium SDK does not support the Android 4.4W SDK (API 20).

Most mobile device manufacturers have been licensed to use Google's enhanced API, which provides support for Maps and other functionality. If this is the case for your target devices, you will need to install the relevant Google packages, listed as Google APIs by Google Inc., Android API x... by the Android SDK Manager tool. In Studio, choose the SDKs with the naming format "Google APIs x.x" to use the enhanced APIs, or those without the "Google APIs" prefix otherwise.

Android SDK packages can be installed using the Android SDK Manager tool. See Installing the Android SDK for detailed instructions.

The default Android SDK can be configured using Studio's Preferences, and then selected per-project using the Run Configurations.

For Android API levels 14 and above, the emulator system images are installed separately from the SDK platform packages. To run in the emulator for Android API 14+, you must install at least one of the emulator system images.

Due to this Android bug, webViews created on a virtual device running Android 2.3.x cause applications to behave erratically and crash. Thus, if developing on an emulator, it is recommended to use one of the other supported versions (Android 2.2, for instance). In contrast, applications that include webViews run as expected on (physical) devices installed with Android 2.3.2+. Note that Google has pronounced 2.3.1 obsolete and, as such, it is not supported.

Android Native Add-on Module Development on Mac OS X

The Xcode command line tools are required to develop native Android add-on modules on Mac OS X.

See Installing the iOS SDK: Installing Command Line Tools for detailed instructions.

Installation

OS X

Note that the typical filesystem location of this software can be found in the OS X Software Locations section of these guides.

Installing Android SDK Tools on OS X

Once you have downloaded the Android SDK Tools archive, double-click to extract it.

  • rename the extracted folder to android-sdk, if you wish to keep it in accordance with the Software Locations section above

  • drag and drop the folder into the your home directory, to complete the installation

images/download/attachments/29004851/Install_Android_SDK_Tools.png

Windows

Note that the typical filesystem location of this software can be found in the Windows Software Locations section of these guides.

Installing Android SDK Tools on Windows

Once you have downloaded the Android SDK Tools Installer, double-click to run it.

  • proceed to the Java SE Development Kit stage and verify that Java SE Development Kit (JDK) version 1.6 has been found

images/download/attachments/29004851/android-sdk-tools-install-01.png

  • at the Choose Install Location step, verify that the Destination Folder is the same as your Android SDK HOME folder, and correct if not. This path will be required when configuring Studio

  • ensure that there is sufficient space for the installation

images/download/attachments/29004851/android-sdk-tools-install-02.png

  • complete the installation

Refer to the Windows Software Locations section, and add the path of the Android SDK Tools directory to your system's PATH.

Then proceed to the Installing Android Packages with Android SDK Manager section.

Installing Android Packages with Android SDK Manager

The Android SDK Tools package that has been installed contains the Android SDK Manager that is used to install the rest of the Android SDK packages.

Launching the Android SDK Manager differs depending on the platform.

  • on OS X, launch its executable directly, at ~/android-sdk/tools/android

  • on Windows, login under your usual user account, right-click the SDK Manager from the Windows Start Menu and select Run as administrator. Enter the Administrator password, if you are prompted for it

In the Android SDK Manager, you will see different versions of the following items listed:

  • Android SDK Tools (mandatory) - includes the Android SDK Manager and Android Virtual Device Manager (android executable)

  • Android SDK Platform Tools (mandatory) - includes Android Debug Bridge, (adb executable)

  • SDK Platform - provides the libraries for building for a specific version of the Android OS that uses the standard Google APIs.

  • Google APIs by Google Inc - provides the libraries for building for a specific version of Android that uses the enhanced Google APIs (includes maps support).

  • System Image - For Android API versions 14 and above, the emulator system images are packaged separately from the SDK Platform package. Three versions of the system images are provided – ARM, Intel x86, and MIPS. The ARM system image is supplied by default in earlier SDK Platform packages, and corresponds to the hardware in most phones.

To run an emulator for Android API level 14 or above, you must install one of the corresponding emulator system images. Starting in Studio Release 3.0, you can choose which system image to launch if you have multiple system images installed for a given API level.

For more information on using the x86 system images, see Installing x86 Emulator Packages.

Set the filter options at the bottom and select the required packages for installation.

  • Click Install x packages button.

  • Select Accept All and click Install.

  • When the download completes, click Yes to restart adb and complete the installation.

Refer to the Titanium Compatibility Matrix for the latest list of required packages.

Installing x86 Emulator Packages

Some versions of the Android API are available with Intel x86 emulators. Look for the "Intel x86 Atom System Image" in the Android SDK Manager.

Starting in Studio Release 3.0, you can select which system image to launch for a given Android API level.

The x86 emulator may run faster than the standard ARM emulator, but may show minor differences with the ARM emulator. Extra software is required to take advantage of the x86 emulator – see Configuring Virtual Machine Acceleration in the Android Tools documentation.

Updating Android Packages

Important to note!

Every time you update your Android packages, you will need to delete any AVDs that have been replaced by new revisions, otherwise they won’t be used. To do this, use the Android SDK Manager Tools > Manage AVDs menu item to launch the Android Virtual Device Manager.

images/download/attachments/29004851/android-avd-manager-01.png

Unless you have modified any AVD’s hardware configuration, it’s easier to simply clear all existing AVDs altogether. Thus, select each one in turn and click the delete button to do this.

images/download/attachments/29004851/android-avd-manager-02.png

Configuring Studio

To use the Android SDK with Titanium Studio, the path to the SDK must be set in the Preferences dialog.

  1. Open the Preferences dialog:

    1. On Mac OS X, from the menu bar, select Titanium Studio > Preferences or Appcelerator Studio > Preferences.

    2. On Windows and Linux, from the menu bar, select Window > Preferences.

  2. Navigate to the Android SDK settings:

    1. On Studio 3.1.0 and later, in the Preferences dialog, navigate to Studio > Platforms > Android SDK.

    2. On Studio 3.0.x and earlier, in the Preferences dialog, navigate to Titanium Studio > Titanium, the Android SDK settings are under the Android section.

  3. Set your Android SDK path. Enter the path to your Android SDK in the Android SDK Home textbox or click the Configure button to navigate to the SDK directory.

  4. Select your default Android SDK. Select a Google APIs item from the Default Android SDK drop-down menu.

Configuring the CLI

To use the Android SDK with the Titanium CLI, the path to the SDK must be set in the Titanium CLI configuration settings. Run the following command and replace /Users/appc/sdk/android-sdk/ with the path to your Android SDK:

titanium config android.sdk /Users/appc/sdk/android-sdk/