1. Install Ubuntu 14.03
Although Android recommends Ubuntu 15, for security, or to install LTS 14.04, step Skip
2. JDK:
Marshmallow need to JDK8, add a source, handy with Java
sudo add-apt-repository ppa:openjdk-r/ppasudo apt-sudo Update-alternatives--config Java
sudo update-alternatives --config javac
3. Load the Dependencies
sudo Install Git-core GnuPG Flex Bison gperf build-essential zipgcc-multilib g++- Multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-Dev CCache LIBGL1Unzip
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. Set the compilation output directory
Export out_dir_common_base=<path-to-your-out-directory>
6. Install a repo tool $ mkdir ~/bin
Outside the wall
mkdir ~/bin
path=~/Bin: $PATH
Curl https: // Storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Inside the wall
CD ~
git clone git://aosp.tuna.tsinghua.edu.cn/android/git-repo.git
Path=~/git-repo: $PATH
7. Build a working directory
mkdir ~/marshmallow
CD ~/Marshmallow
Inside the wall
Specify head version
Repo Init-u git://aosp.tuna.tsinghua.edu.cn/aosp/platform/manifest
Specify Branch
-B android-6.0.1_r16
Outside the wall
-u https://android.googlesource.com/platform/manifest
Or
-u https:-b android-6.0.1_r16
Synchronizing code
$ repo Sync
8.
Android 6 Build Environment Setup (Marshmallow)