Supporting Older Versions

These requirements apply to older versions of Android. For the Android Open Source Project (AOSP) master branch, see the standard Requirements and Establishing a Build Environment. For Android versions 8.0 (Oreo or O) through 5.0 (Lollipop or L), consider using the included Dockerfile to ease installation of all required packages.

Operating systems

Android is typically built with a GNU/Linux or Mac OS operating system. It is also possible to build Android in a virtual machine on unsupported systems such as Windows.

We recommend building on GNU/Linux instead of another operating system. The Android build system normally uses ART, running on the build machine, to pre-compile system dex files. Since ART is able to run only on Linux, the build system skips this pre-compilation step on non-Linux operating systems, resulting in an Android build with reduced performance.

GNU/Linux

  • Android 6.0 (Marshmallow) - AOSP master: Ubuntu 14.04 (Trusty)
  • Android 2.3.x (Gingerbread) - Android 5.x (Lollipop): Ubuntu 12.04 (Precise)
  • Android 1.5 (Cupcake) - Android 2.2.x (Froyo): Ubuntu 10.04 (Lucid)

Mac OS (Intel/x86)

  • Android 6.0 (Marshmallow) - AOSP master: Mac OS v10.10 (Yosemite) or higher with Xcode 4.5.2 and Command Line Tools
  • Android 5.x (Lollipop): Mac OS v10.8 (Mountain Lion) with Xcode 4.5.2 and Command Line Tools
  • Android 4.1.x-4.3.x (Jelly Bean) - Android 4.4.x (KitKat): Mac OS v10.6 (Snow Leopard) or Mac OS X v10.7 (Lion) and Xcode 4.2 (Apple's Developer Tools)
  • Android 1.5 (Cupcake) - Android 4.0.x (Ice Cream Sandwich): Mac OS v10.5 (Leopard) or Mac OS X v10.6 (Snow Leopard) and the Mac OS X v10.5 SDK

Make

For versions older than the AOSP master branch through Android 4.1.x (Jelly Bean), use GNU Make 3.82. For Android 4.0.x (Ice Cream Sandwich) and earlier, revert from make 3.82 to avoid build errors.

Xcode and other packages

For older versions of Mac OS (10.8 or earlier), you must install Xcode from the Apple developer site. If you are not already registered as an Apple developer, you must create an Apple ID to download.

If using Mac OS X v10.4, also install bison:

    POSIXLY_CORRECT=1 sudo port install bison

For MacPorts, issue:

    POSIXLY_CORRECT=1 sudo port install gmake libsdl git gnupg

For Homebrew, issue:

    brew install gmake libsdl git gnupg2

Reverting from make 3.82

In Android 4.0.x (Ice Cream Sandwich) and earlier, a bug exists in gmake 3.82 that prevents Android from building. You can install version 3.81 using MacPorts with these steps:

  1. Edit /opt/local/etc/macports/sources.conf and add a line that says:
        file:///Users/Shared/dports
    above the rsync line. Then create this directory:
        mkdir /Users/Shared/dports
  2. In the new dports directory, run:
        svn co --revision 50980 http://svn.macports.org/repository/macports/trunk/dports/devel/gmake/ devel/gmake/
  3. Create a port index for your new local repository:
        portindex /Users/Shared/dports
  4. Install the old version of gmake with:
        sudo port install gmake @3.81

JDK

JDK for Linux

The master branch of Android in the Android Open Source Project (AOSP) comes with prebuilt versions of OpenJDK below prebuilts/jdk/ so no additional installation is required.

Older versions of Android require a separate installation of the JDK. On Ubuntu, use OpenJDK. See JDK Requirements for precise versions and the sections below for instructions.

For Ubuntu >= 15.04

Run the following:

sudo apt-get update
sudo apt-get install openjdk-8-jdk

For Ubuntu LTS 14.04

There are no available supported OpenJDK 8 packages for Ubuntu 14.04. The Ubuntu 15.04 OpenJDK 8 packages have been used successfully with Ubuntu 14.04. Newer package versions (e.g. those for 15.10, 16.04) were found not to work on 14.04 using the instructions below.

  1. Download the .deb packages for 64-bit architecture from old-releases.ubuntu.com:
  2. Optionally, confirm the checksums of the downloaded files against the SHA256 string listed with each package above. For example, with the sha256sum tool:
        sha256sum {downloaded.deb file}
  3. Install the packages:
        sudo apt-get update
    Run dpkg for each of the .deb files you downloaded. It may produce errors due to missing dependencies:
        sudo dpkg -i {downloaded.deb file}
    To fix missing dependencies:
        sudo apt-get -f install

Update the default Java version - optional

Optionally, for the Ubuntu versions above update the default Java version by running:

sudo update-alternatives --config java
sudo update-alternatives --config javac