With a new version of Ubuntu comes an update to my guide for setting up a build environment to compile Android ROMs. The aim of this is to simplify the configuration process and teach a little bit about the command line.

Follow the directions step-by-step. All you have to do is copy and paste the code in order, it will be up and running in no time!

This guide applies to all variations of Ubuntu 16.04 LTS Xenial Xerus 64 bit. Do not use the 32 Bit version.

Also, PAY CLOSE ATTENTION when to use "sudo" and when to not. It can cause unexpected issues if you do something as root that you shouldn't.

Much thanks goes out to Google, ProTekk, Canonical, and everyone else that I read a random paragraph here and snippet there.

Ready to begin?

1) Unless it's a completely fresh Ubuntu installation, many people might have the wrong version of Java installed. Let's fix that first.

The command below makes sure you're starting with a clean slate. Copy and paste it into a terminal (command prompt) window:

Code:
sudo apt-get remove openjdk-* icedtea-* icedtea6-*

If necessary, follow the on-screen instructions to remove any stray Java versions. Otherwise, move on to the next step.

2) Install the main build tools with this command:

Code:
sudo apt-get install openjdk-8-jdk git ccache automake lzop bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 g++-multilib python-networkx libxml2-utils bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush schedtool dpkg-dev liblz4-tool make optipng maven

That's it on the package side of things.

3) "repo" communicates with git servers for all that precious source code. The next command will grab it:

Code:
mkdir ~/bin && curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo

4) Use your favorite text editor to open ~/.bashrc - I like nano:

Code:
nano ~/.bashrc

5) At the very bottom (use the Page Down key) paste this code to a new line:

Code:
export PATH=~/bin:$PATH
export USE_CCACHE=1

6) Save it. In nano that would be Ctrl-O and then Enter. Then Ctrl-X to exit back to a prompt. Restart bash:

Code:
source ~/.bashrc

7) In the terminal, navigate to where you would like to download the Android source code. The commands below will make it in your home folder, but if you have limited space you may want to create it somewhere else. Faster is better, i.e. SSD would be best, USB external (even 3.0) will be comparatively slow. Here we go:

Code:
mkdir ~/android
cd ~/android

8) Now you're going to initialize the repo. This is where you decide the flavor of Android you want to build, i.e. AOKP, CyanogenMod, AOSP etc.

For the purposes of this tutorial, here's the command for Cyanogenmod 13 (Marshmallow) :

Code:
repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0

9) Last step. Time to get the source, many gigabytes of downloading await.

Don't worry, it's automated. It's the last one!

Code:
repo sync

Check back periodically every hour or so. It all depends on how fast your connection is.

That should be everything. Now you are ready to build Android. Good luck!

If this guide helped you out, feel free to click the Thanks! button

Some ROMs require OpenJDK 7. Here's the easiest way to install it on Ubuntu 16.04 since it's no longer in the main repositories.

First, add the PPA for OpenJDK:

Code:
sudo add-apt-repository ppa:openjdk-r/ppa

Then, install OpenJDK 7:

Code:
sudo apt-get update && sudo apt-get install openjdk-7-jdk

Finally, tell your system which version of Java and Java Compiler to use with the following commands. Enter each one separately and make the appropriate selection for OpenJDK 7:

Code:
sudo update-alternatives --config java
sudo update-alternatives --config javac

That's it! Everything should be ready to go.

http://forum.xda-developers.com/chef-central/android/guide-how-to-setup-ubuntu-16-04-lts-t3363669

https://source.android.com/source/initializing.html

http://blog.csdn.net/fuchaosz/article/details/51487585

[GUIDE] How to Setup Ubuntu 16.04 LTS Xenial Xerus for Compiling Android ROMs的更多相关文章

  1. Ubuntu 16.04 LTS (Xenial Xerus)

    Canonical刚刚正式发布了Ubuntu 16.04 LTS (Xenial Xerus),这是一个长期支持版本,官方会提供长达5年的技术支持(包括常规更新/Bug修复/安全升级),一直到2021 ...

  2. Ubuntu 16.04 LTS 正式发布:系统将持续更新5年

    Canonical 刚刚正式发布了Ubuntu 16.04 LTS (Xenial Xerus),这是一个长期支持版本,官方会提供长达5年的技术支持(包括常规更新/Bug修复/安全升级),一直到202 ...

  3. Ubuntu 16.04 LTS GNOME版本下载

    下载地址: http://cdimage.ubuntu.com/ubuntu-gnome/releases/ Ubuntu GNOME发行版本启动已经有三年的时间了,在社区用户对于在稳定可靠的Ubun ...

  4. Ubuntu 16.04 LTS发布

    [Ubuntu 16.04 LTS发布]Ubuntu 16.04 LTS 发布日期已正式确定为 2016 年 4 月 21 日,代号为 Xenial Xerus.Ubuntu16.04 将是非常受欢迎 ...

  5. Ubuntu 16.04 LTS 安装 Nginx/PHP 5.6/MySQL 5.7 (LNMP) 与Laravel

    Ubuntu 16.04 LTS 安装 Nginx/PHP 5.6/MySQL 5.7 (LNMP) 与Laravel 1.MySQL安装[安装 MariaDB]MariaDB是MySQL的一个分支首 ...

  6. tips of my ubuntu 16.04 LTS

    update_0 : sudo .../idea.sh 才会把idea安装上,不加sudo也会启动,但是不会在开始菜单中找到程序. ---------------------------------- ...

  7. Ubuntu 16.04 LTS安装好需要设置的15件事(喜欢新版本)

    看到这篇文章说明你已经从老版本升级到 Ubuntu 16.04 或进行了全新安装,在安装好 Ubuntu 16.04 LTS 之后建议大家先做如下 15 件事.无论你是刚加入 Ubuntu 行列的新用 ...

  8. Ubuntu 16.04 LTS U盘安装要点

    一.UltraISO UltraISO是一款功能强大而又方便实用的光盘映像文件制作/编辑/转换工具,它可以直接编辑ISO文件和从ISO中提取文件和目录,也可以从CD-ROM制作光盘映像或者将硬盘上的文 ...

  9. Ubuntu 16.04 LTS安装 TeamViewer

    Ubuntu 16.04 LTS安装 TeamViewer     64位Ubuntu 16.04系统需要添加32位架构支持,命令如下. sudo dpkg --add-architecture i3 ...

随机推荐

  1. iOS-汉字排序

    * 在IOS开发过程中,排序是我们经常遇到的问题,那么如何进行排序呢? * 在英文状态下,系统中有直接可以调用的方法.    例如:对数组[sss, aaa, bbb, ppp]进行排序,我们可以直接 ...

  2. java面试题之哨兵如何判断主服务器是否下线?

    通过流言协议来接收关于主服务器是否下线的信息,并使用投票协议来决定是否执行自动故障迁移,以及选择哪个从服务器作为新的主服务器.

  3. 【bzoj2216】[Poi2011]Lightning Conductor 1D1D动态规划优化

    Description 已知一个长度为n的序列a1,a2,…,an.对于每个1<=i<=n,找到最小的非负整数p满足 对于任意的j, aj < = ai + p – sqrt(abs ...

  4. Springboot 版本+ jdk 版本 + Maven 版本的匹配

    Spring boot 版本 Spring Framework jdk 版本 maven 版本 1.2.0 版本之前 6 3.0 1.2.0 4.1.3+ 6 3.2+ 1.2.1 4.1.3+ 7 ...

  5. Cython 一篇通

    Cython的类型 1 类型定义 1.1 定义一个C变量: 1.1.1 在Cython里定义一个C变量和C语言类似,不同的地方就是在声明的最前面要加上cdef,另外,末尾不用加分号";“如: ...

  6. Scrapy学习-13-使用DownloaderMiddleware设置IP代理池及IP变换

    设置IP代理池及IP变换方案 方案一: 使用国内免费的IP代理 http://www.xicidaili.com # 创建一个tools文件夹,新建一个py文件,用于获取代理IP和PORT from ...

  7. hdu 4503(数学,概率)

    湫湫系列故事——植树节 Time Limit: 1000/500 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total ...

  8. 详解webpack-dev-server的配置属性

    1.devServer.contentBase   它指定了服务器资源的根目录,如果不写入contentBase的值,那么contentBase默认是项目的目录. 在上面例子中产生错误和后来解决错误的 ...

  9. Unity3D Shader 入门之简单案例的实现(通过法线实现颜色变化)

    在没有接触Unity3D  Shader 之前,总感觉shader特别神奇,因为听说是对渲染流水线进行编程,就是对GPU进行编程.听着特别高大上.这不,最近刚刚接触Shader,学了几个小案例,然后本 ...

  10. Linux Root下的.gvfs出现异常解决办法(导致source失败,自启动失败)

    原文地址:   http://www.cnblogs.com/tdyizhen1314/p/4142991.html 在linux系统下安装软件或复制文件的时候,复制不成功,出现错误如下: error ...