[GUIDE] How to Setup Ubuntu 16.04 LTS Xenial Xerus for Compiling Android ROMs

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

时间: 2024-12-21 13:41:28

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

Ubuntu 16.04 LTS (Xenial Xerus)

Canonical刚刚正式发布了Ubuntu 16.04 LTS (Xenial Xerus),这是一个长期支持版本,官方会提供长达5年的技术支持(包括常规更新/Bug修复/安全升级),一直到2021年4月份,而且后续会按惯例发布16.04.1.16.04.2.16.04.3等升级版本. Ubuntu 16.04最大的变化就是采用了Linux 4.4版系统内核,同时对几乎所有系统应用都进行了升级,包括LibreOffice 5.1.2.Mozilla Firefox 45.0.2.Python

Ubuntu 16.04 LTS GNOME版本下载

下载地址: http://cdimage.ubuntu.com/ubuntu-gnome/releases/ Ubuntu GNOME发行版本启动已经有三年的时间了,在社区用户对于在稳定可靠的Ubuntu Linux基础上使用纯净的GNOME桌面环境的强烈要求在随后变成了官方Ubuntu风格(Flavor),尽管由于Unity接口的从属冲突在技术上出现了很大障碍.在Ubuntu 16.04 LTS系统正式发布的同时,Ubuntu GNOME团队官方推出了Ubuntu GNOME 16.04 LT

Ubuntu 16.04 LTS

Ubuntu 16.04 LTS  64位系统 针对Android 6.0 sudo apt install git-core bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop maven openjdk-7-jdk pngcrush schedtool squas

[Android 编译(一)] Ubuntu 16.04 LTS 成功编译 Android 6.0 源码教程

本文转载自:[Android 编译(一)] Ubuntu 16.04 LTS 成功编译 Android 6.0 源码教程 1 前言 经过3天奋战,终于在Ubuntu 16.04上把Android 6.0的源码编译出来了,各种配置,各种error,各种爬坑,特写此博客记录爬坑经历.先上图,Ubuntu上编译完后成功运行模拟器,如图: 2 编译环境 UbuntuKylin 16.04 LTS Android 6.0_r1 Open JDK 7 3 准备工作 (1) 下载android 6.0源码.

EJBCA的安装(基于Ubuntu 16.04 LTS + wildfly8 + ejbca6.3.11 + jdk7)

前一段时间折腾了一下PKI,用EJBCA在研究院内网搭建了一个CA,目前是提供给手机端(安卓和IOS)来和服务器端(nginx + Java应用)做安全连接的(客户端和服务器端双向认证) 由于EJBCA官方的安装文档太不靠谱了,按照官方的文档来做的话会遇到各种坑, 所以记录一下我安装的过程.希望能给用到的人有一点帮助. 这里也贴一下官方的文档地址:https://www.ejbca.org/docs/installation.html 环境和所依赖的软件包: Ubuntu 16.04 LTS,

Ubuntu 16.04 LTS 安装libvips出现”Package vips was not found in the pkg-config search path”

使用libvips来操作图像,libvips的部署参考一个Node.js工程:https://github.com/lovell/sharp 在MAC下安装很顺利,到Linux环境下(Ubuntu 16.04 LTS)出现了如下问题: # pkg-config --cflags vips vips vips vips Package vips was not found in the pkg-config search path. Perhaps you should add the direc

Ubuntu 16.04 LTS安装好之后需要做的15件事

看到这篇文章说明你已经从老版本升级到 Ubuntu 16.04 或进行了全新安装,在安装好 Ubuntu 16.04 LTS 之后建议大家先做如下 15 件事.无论你是刚加入 Ubuntu 行列的新用户,还是有经验的老用户,你都会发现一些非常有用的调整和建议. 1.了解Ubuntu 16.04 LTS新特性 新选项!新应用程序!新内核!新的…… 所有东西都是新的! Ubuntu 16.04 LTS 带来了一些让人兴奋的新功能和变化,所以在开始使用之前建议各位一定要花几分钟熟悉一下新的改进. 如果

Ubuntu 16.04 LTS发布

[Ubuntu 16.04 LTS发布]Ubuntu 16.04 LTS 发布日期已正式确定为 2016 年 4 月 21 日,代号为 Xenial Xerus.Ubuntu16.04 将是非常受欢迎的开源操作系统 Ubuntu 的第 6 个长期支持版本,其首个 LTS 版本发布于 2006 年 6 月.Ubuntu 16.04 Xenial Xerus 将包含 Unity 7 桌面.Linux Kernel 4.4 和 超多应用程序更新默认支持ZFS文件系统. 支持snap package和d

在Ubuntu 16.04 LTS安装Mattermost(二)

在Ubuntu 16.04 LTS安装Mattermost(一) 配置Mattermost 创建系统管理员用户,设置Mattermost的一般用途 .打开浏览器,导航到Mattermost实例.比如:Mattermost服务器IP地址为10.10.10.10,然后访问http://10.10.10.10:8065. .创建第一个团队和用户,第一个用户是系统管理员(system_admin)角色,有权限访问系统控制台 .打开系统控制台.点击导航面板顶部的用户名,在打开的菜单中,点击系统控制台-Sy