Android 6编译环境搭建 (Marshmallow)

时间:2024-01-11 09:52:14

1.安装 ubuntu 14.03

尽管android推荐 ubuntu 15, 安全起见,还是装LTS的14.04,步骤跳过

2. JDK:

Marshmallow 需要 JDK8 ,添个源,顺手配下java

sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo update-alternatives --config java
sudo update-alternatives --config javac

3.装下依赖项

sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip

4. adb USB

 wget -S -O - http://source.android.com/source/51-android.rules | sed "s/<username>/$USER/" | sudo tee >/dev/null /etc/udev/rules.d/51-android.rules; sudo udevadm control --reload-rules

5.设置编译输出目录

export OUT_DIR_COMMON_BASE=<path-to-your-out-directory>

6.装个REPO工具$ mkdir ~/bin



墙外
mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
 
墙内

cd ~
git clone git://aosp.tuna.tsinghua.edu.cn/android/git-repo.git
PATH=~/git-repo:$PATH

7.建个工作目录

mkdir ~/marshmallow
cd ~/marshmallow
墙内


指定Head版本
repo init -u git://aosp.tuna.tsinghua.edu.cn/aosp/platform/manifest
指定分支
repo init -u git://aosp.tuna.tsinghua.edu.cn/aosp/platform/manifest -b android-6.0.1_r16
 
墙外
repo init -u https://android.googlesource.com/platform/manifest
或者

repo init -u https://android.googlesource.com/platform/manifest -b android-6.0.1_r16
 
同步代码
$ repo sync


8.