Original URL: http://source.android.com/source/initializing.html
Initializing a Build environmentin this DOCUMENT
- Choosing a Branch
- Setting up a Linux build environment
- Installing the JDK
- Installing required Packages (Ubuntu 14.04)
- Installing required Packages (Ubuntu 12.04)
- Installing required Packages (Ubuntu 10.04--11.10)
- Configuring USB Access
- Setting up CCache
- Using a separate output directory
- Setting up a MAC OS build environment
- Creating a case-sensitive disk image
- Installing the JDK
- Master Branch
- Branch 5.0.x and earlier branches
- Branch 4.4.x and earlier branches
- Branch 4.0.x and all earlier branches
- Next:download the source
This sections describes how to set up your local work environment to build the Android source files. You'll need to use Linux or Mac OS. Building under Windows is not currently supported.
For a overview of the entire Code-review and code-update process, see Life of a Patch.
Choosing a Branch
Some of the requirements for your build environment is determined by which version of the source code your plan to compile . See Build Numbers-a full listing of branches-choose from. Also choose to download and build the latest source code (called "Master"), in which case you'll simply omit the Branch specification When you initialize the repository.
Once You has selected a branch, follow the appropriate instructions below to set up your build environment.
Setting up a Linux build environment
These instructions apply to all branches, including master.
The Android build is routinely tested in house on recent versions of Ubuntu LTS (14.04), but most distributions should hav E The required build tools available. Reports of successes or failures on other distributions is welcome.
For Gingerbread (2.3.x) and newer versions, including the Master branch, a 64-bit environment is required. Older versions can be compiled on 32-bit systems.
Note: See the Downloading and Building page for the list of hardware and software requirements. Then follow the detailed instructions for Ubuntu and Mac OS below.
Installing the JDK
The master branch of Android in the Android Open Source Project (AOSP) requires Java 7. On Ubuntu, Useopenjdk.
Java 7:for The latest version of Android
$ sudo apt-get update
$ sudo apt-get install openjdk-7-jdk
Optionally, update the default Java version by running:
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac
If you are encounter version errors for Java, set it path as described in the wrong Java version section.
To develop older versions of Android, download and install the corresponding version of the Java JDK:
Java 6:for Gingerbread through KitKat
Java 5:for cupcake through Froyo
Note: The lunch
command in the build step would ensure that the Sun JDK was used instead of any previously Installe D JDK.
Installing required Packages (Ubuntu 14.04)
You'll need a 64-bit version of Ubuntu. Ubuntu 14.04 is recommended.
$ sudo apt-get install bison g++-multilib git gperf libxml2-utils
Installing required Packages (Ubuntu 12.04)
12.04 to build older versions of Android. Version 12.04 is not supported on master or recent releases.
$ sudo apt-GetInstall git GnuPG Flex Bison gperf Build-Essential\
Zip Curl Libc6-Dev libncurses5-Dev:i386 X11proto-Core-Dev\
Libx11-Dev:i386 Libreadline6-Dev:i386 LIBGL1-Mesa-Glx:I386\
Libgl1-Mesa-Dev g++-Multilib Mingw32 Tofrodos\
Python-Markdown LIBXML2-Utils Xsltproc zlib1g-Dev:i386
$ sudo ln -s / Usr/lib/i386- linux-gnu/mesa/libgl.. 1 /usr/lib /i386-linux- gnu/libgl. So
Installing required Packages (Ubuntu 10.04--11.10)
Building on Ubuntu 10.04-11.10 are no longer supported, but could be useful for Building older releases of AOSP.
$ sudo apt-GetInstall git GnuPG Flex Bison gperf Build-Essential\
Zip Curl zlib1g-Dev Libc6-dev lib32ncurses5-dev ia32- libs \
X11proto- core-dev libx11-dev Lib32readline5-dev lib32z-dev \
Libgl1-mesa -dev g++-multilib mingw32 tofrodos python< Span class= "pun" >-markdown \
LIBXML2 -utils xsltproc
On Ubuntu 10.10:
$ sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so
On Ubuntu 11.10:
$ sudo apt-get install libx11-dev:i386
Google officially provides the environment for compiling Android source initialization, Initializing a Build environment