Android downloads and compiles system source code on ubuntu
There are also many such tutorials on the Internet. Here we just record them for future viewing.
Download source code
Perform the following steps:
1. Configure the installation and download Environment
Configure the JDK Environment
Install curl and git-core software
Sudo apt-get install curl
Sudo apt-get install git-core
2. Create ~ /Bin directory and add it to Environment Variables
Mkdir ~ /Bin
PATH = ~ /Bin: $ PATH
3. Download the repo script and modify the permission to be executable.
Curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo> ~ /Bin/repo (this may cause download timeout)
Curl http://php.webtutor.pl/en/wp-content/uploads/2011/09/repo> ~ /Bin/repo (this can be downloaded if the download fails)
Chmod a + x ~ /Bin/repo
4. Create a directory for saving the android source code, change it to the maximum permission, and enter the Directory
Mkdir/opt/android_source
Sudo chmod-R 777/opt/android_source
Cd/opt/android_source
5. initialize the repo and select the branch (version) to be downloaded)
Repo init-u https://android.googlesource.com/platform/manifest (this is the latest source code)
Repo init-u https://android.googlesource.com/platform/manifest-B android-4.2_r1 (this is Android4.2 system source code, other versions as long as the change branch number can be)
6. You are prompted to enter your name and email address.
7. Download source code
Repo sync
Common Errors:
Case 1:
Error: Failed onnect o android.googlesource.com: 443;
Connection efused while accessing
Https://android.googlesource.com/a/platform/frameworks/base/info/refs
Fatal: HTTP request failed
Error: Cannot fetch platform/tools/motodev
Error: Cannot fetch platform/frameworks/base
Error: Cannot fetch platform/prebuilts/sdk
Error: Exited sync due to fetch errors
Solution:
Edit the/etc/hosts file
Vim/etc/hosts
Add the following content and save it.
74.125.31.82 www.googlesource.com
74.125.31.82 android.googlesource.com
203.208.46.172 cache.pack.google.com
59.24.3.173 cache.pack.google.com
Compile source code
1. Download Required Software
Sudo apt-get install git gnupg flex bison gperf build-essential
Zip curl libc6-dev libncurses5-dev: i386 x11proto-core-dev
Libx11-dev: i386 Co., libreadline6-dev: i386 libgl1-mesa-glx: i386
Libgl1-mesa-dev g ++-multilib mingw32 tofrodos
Python-markdown libxml2-utils xsltproc zlib1g-dev: i386
2. Create a link
Sudo ln-s/usr/lib/i386-linux-gnu/mesa/libGL. so.1/usr/lib/i386-linux-gnu/libGL. so
3. Configure gcc
Sudo apt-get install gcc-4.4
Sudo apt-get install g ++-4.4
4. Compile the source code
Cd/opt/android_source
Source build/envsetup. sh or. build/envsetup. sh
Lunch full-eng
Make-j4
5. Start the simulator.
Emulator