Google officially provides the environment for compiling Android source initialization, Initializing a Build environment

Source: Internet
Author: User
Tags gnupg

Original URL: http://source.android.com/source/initializing.html

Initializing a Build environmentin this DOCUMENT
    1. Choosing a Branch
    2. Setting up a Linux build environment
      1. Installing the JDK
      2. Installing required Packages (Ubuntu 14.04)
      3. Installing required Packages (Ubuntu 12.04)
      4. Installing required Packages (Ubuntu 10.04--11.10)
      5. Configuring USB Access
      6. Setting up CCache
      7. Using a separate output directory
    3. Setting up a MAC OS build environment
      1. Creating a case-sensitive disk image
      2. Installing the JDK
      3. Master Branch
      4. Branch 5.0.x and earlier branches
      5. Branch 4.4.x and earlier branches
      6. Branch 4.0.x and all earlier branches
    4. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.