1. Installing OPENJDK-7-JDK
Android 5.0 uses a JDK that is no longer an Oracle JDK, but an open source OpenJDK, after Ubuntu is installed, install the JDK using the following command:
$sudo apt-get Install OPENJDK-7-JDK
When installed, set environment variables:
At the end of the/etc/profile file, add:
- java_home=/usr/lib/jvm/java-7-openjdk-amd64/
- Path= $PATH: $HOME/bin: $JAVA _home/bin
- Export Java_home
- Export PATH
2. Installing software that relies on compilation
Install the dependent software using the following command:
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 Dpkg-dev
sudo ln-s/usr/lib/i386-linux-gnu/mesa/libgl.so.1/usr/lib/i386-linux-gnu/libgl.so
3. Configure the Cache
Configure the cache with the following command:
sudo apt-get install CCache
SOURCE ~/.BASHRC
4. Download Repo
1) Create repo directory
mkdir ~/bin
Path=~/bin: $PATH
2) Download repo (official repo can not download, the other repo mostly older, this time relatively new, I looked for a long cry)
git clone git://aosp.tuna.tsinghua.edu.cn/android/git-repo.git/
Copy the repo files from the Git-repo to the bin directory after cloning
CP Git-repo/repo ~/bin/
To modify the repo file, set Repo_url as follows:
Repo_url = ' Git://aosp.tuna.tsinghua.edu.cn/android/git-repo '
5. Initialize Repo
1) Create a directory
mkdir ~/AOSP
2) Initialize Repo
CD ~/AOSP
Repo Init-u git://aosp.tuna.tsinghua.edu.cn/android/platform/manifest-b ANDROID-5.0.2_R1
PS: When initializing, the prompt requires email authentication, using the following command:
git config--global user.email "[Email protected]"
git config--global user.name "Your name"
6. Replace the existing AOSP source code remote
If you have previously obtained the source of the AOSP by some means, but you want to be in the future through tuna synchronization, only need to be in the . Repo/manifest.xml
<remote name= "Aosp" fetch= "..." review= "https://android-review.googlesource.com/"/>
change to the following code:
<remote name= "Aosp" fetch= "Git://aosp.tuna.tsinghua.edu.cn/android/ " review= "https://android-review.googlesource.com/"/>
This method can also be used to synchronize part of the code from tuna while synchronizing the CyanogenMod code
7. Download the source code
Repo Sync
PS: Here is the source of the download, it takes a long time, I under the behavior of 1M broadband needs more than 4 hours
8. Source code Compilation
PS: Compilation process comparison, my computer dual-core, using single-threaded compilation, time bit about 12 hours, if using multi-threading, time should be exponentially reduced
1) Set the cache
CD AOSP
Prebuilts/misc/linux-x86/ccache/ccache-m 50G
2) initializing the compilation environment
. build/envsetup.sh
3) Select compile target Package
Ps:lunch the way there are many, you can use the lunch command to view, I use the most commonly used
Lunch Aosp_arm-eng
4) Compiling
Make
Ps:1.make later can be more parameters: such as your machine when dual-core, per-core dual-threaded words, using make-j4, so faster, but the compilation of memory used more
After 2.make fails or stops, you can continue compiling with make-k
9. Results show:
$emulator &
REF:
Ubuntu14.10 compile Android5.0 Source code:
http://blog.csdn.net/chouretang/article/details/43769839
Compile-time referenced blog post:
1.http://blog.csdn.net/gobitan/article/details/24367439
2.https://wiki.tuna.tsinghua.edu.cn/mirrorusage/android
Ubuntu Download & compile Android5.0 source code