In this document

Choosing a Branch
    Setting up a Linux build environment
        Installing the JDK
        Installing required packages (Ubuntu 12.04)
        Installing required packages (Ubuntu 14.04)
        Installing required packages (Ubuntu 10.04 -- 11.10)
        Configuring USB Access

This section describes how to set up your local work environment to build the Android source files. You will need to use Linux or Mac OS. Building under Windows is not currently supported.

Note: The source download is approximately 8.5GB in size. You will need over 30GB free to complete a single build, and up to 100GB (or more) for a full set of builds.

For an 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 are determined by which version of the source code you plan to compile. See Build Numbers for a full listing of branches you may choose from. You may also choose to download and build the latest source code (called "master"), in which case you will simply omit the branch specification when you initialize the repository.

Once you have 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 (12.04), but most distributions should have the required build tools available. Reports of successes or failures on other distributions are 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: It is also possible to build Android in a virtual machine. If you are running Linux in a virtual machine, you will need at least 16GB of RAM/swap and 30GB or more of disk space in order to build the Android tree.

See the Downloading and Building page for the list of hardware and software requirements. Then follow the detailed instructions for Ubuntu and MacOS below.
Installing the JDK

The master branch of Android in the Android Open Source Project (AOSP) requires Java 7. On Ubuntu, use OpenJDK.

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 encounter version errors for Java, set its 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 will ensure that the Sun JDK is used instead of any previously installed JDK.
Installing required packages (Ubuntu 12.04)

You will need a 64-bit version of Ubuntu. Ubuntu 12.04 is recommended. Building using an older version of Ubuntu is not supported on master or recent releases.

$ sudo apt-get install 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-dri: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.so.1 /usr/lib/i386-linux-gnu/libGL.so

Installing required packages (Ubuntu 14.04)

Building on Ubuntu 14.04 is experimental at the moment but will eventually become the recommended environment.

$ sudo apt-get install bison g++-multilib git gperf libxml2-utils

Installing required packages (Ubuntu 10.04 -- 11.10)

Building on Ubuntu 10.04-11.10 is no longer supported, but may be useful for building older releases of AOSP.

$ sudo apt-get install git-core 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-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

Configuring USB Access

Under GNU/linux systems (and specifically under Ubuntu systems), regular users can't directly access USB devices by default. The system needs to be configured to allow such access.

The recommended approach is to create a file /etc/udev/rules.d/51-android.rules (as the root user) and to copy the following lines in it. <username> must be replaced by the actual username of the user who is authorized to access the phones over USB.

Config the Android 5.0 Build Environment的更多相关文章

  1. Android Initializing a Build Environment

    from://https://source.android.com/source/initializing.html#next-download-the-source Initializing a B ...

  2. google官方提供的编译android源码的环境初始化,Initializing a Build Environment

    原文网址:http://source.android.com/source/initializing.html Initializing a Build Environment IN THIS DOC ...

  3. Android 4.0源码目录结构

    转:http://blog.csdn.net/xiangjai/article/details/9012387 在学习Android的过程中,学习写应用还好,一开始不用管太多代码,直接调用函数就可以了 ...

  4. Initializing a Build Environment

    This section describes how to set up your local work environment to build the Android source files. ...

  5. Android 4.0 ProGuard 代码混淆 以及 proguard returned with error code 1.See console异常的解决方法

    最近呢说要上线,就去找了下上线的方法...之前做过代码混淆,用的是progarud.cfg,但是呢自己反编译了之后还是无效,然后就丢着先不管了,因为实在不知道什么情况.今天来上线的时候结果总是报错,总 ...

  6. Android 5.0之后屏幕截图的方法

    截图的几种方法 Android获取屏幕截图主要有以下三种方法 1.通过view.getDrawingCache()获取指定View的绘制缓存来实现截屏. 这种方式Android 5.0之前也可以,且不 ...

  7. android 7.0 多渠道打包 - 美团开源工具Walle 命令行打包

    在Android 7.0(Nougat)推出了新的应用签名方案APK Signature Scheme v2后,之前快速生成渠道包的方式(美团Android自动化之旅-生成渠道包)已经行不通了,对此美 ...

  8. Ubantu16.04进行Android 8.0源码编译

    参考这篇博客 经过测试,8.0源码下载及编译之后,占用100多G的硬盘空间,尽量给ubantu系统多留一些硬盘空间,如果后续需要在编译好的源码上进行开发,需要预留更多的控件,为了防止后续出现文件权限问 ...

  9. Android开发之深入理解Android 7.0系统权限更改相关文档

    http://www.cnblogs.com/dazhao/p/6547811.html 摘要: Android 6.0之后的版本增加了运行时权限,应用程序在执行每个需要系统权限的功能时,需要添加权限 ...

随机推荐

  1. poj 3083 Children of the Candy Corn(DFS+BFS)

    做了1天,总是各种错误,很无语 最后还是参考大神的方法 题目:http://poj.org/problem?id=3083 题意:从s到e找分别按照左侧优先和右侧优先的最短路径,和实际的最短路径 DF ...

  2. 函数page_align

    /************************************************************//** Gets the start of a page. @return ...

  3. php类 静态变量赋值 static $name="abc"

    <?php class test { static $name="abc"; } echo test::$name; 1.巴斯科范式 class_statement: var ...

  4. 【express】

    app.use(express.favicon(__dirname + '/public/images/favicon.ico'));不支持png格式

  5. js返回上一页并刷新的多种方法

    js返回上一页并刷新的几种方法.参考链接:http://www.jbxue.com/article/11230.html <a href="javascript:history.go( ...

  6. 根据权限显示隐藏SharePoint 2010快速启动栏的链接

    转:http://www.360sps.com/Item/ShowAndHiddenLink.aspx 在SharePoint 2010的快速启动栏中可以根据权限来显示或隐藏列表.库.网站的链接,如果 ...

  7. NET下RabbitMQ实践[示例篇]

    在上一篇文章中,介绍了在window环境下安装erlang,rabbitmq-server,以免配置用户,权限,虚拟机等内容.         今天将会介绍如果使用rabbitmq进行简单的消息入队, ...

  8. 在MFC[转载]在MFC状态栏显示时间 状态栏显示时间

    原文:在MFC状态栏显示时间,谢小哈皮儿 c/c++ vc 在mfc状态栏显示时间,在VC的控件中有个Status bar可以在窗体状态栏中添加日期和时间.其实通过简单的代码,你就能创建一个有时钟显示 ...

  9. 【转】ubuntu自动挂载硬盘方法

    首先建立挂载目录例如:sudo mkdir /movie #根目录下建立movie文件夹sudo mkdir /work   #根目录下建立work文件夹 然后查看硬盘信息sudo fdisk -l ...

  10. HDU 1520-Anniversary party(树形dp入门)

    题意: n个人参加party,已知每人的欢乐值,给出n个人的工作关系树,一个人和他的顶头上司不能同时参加,party达到的最大欢乐值. 分析:dp[i][f],以i为根的子树,f=0,i不参加,f=1 ...