Download the Android source code from the image of Tsinghua University, compile the source code, and download the android image.
Previously, I used SourceInsight in Windows to check the source code. Although the source code has been studied, I am sorry... Over the weekend, we are going to download and compile the source code on the Ubuntu virtual machine.
When I used the source code, I had some knowledge about the Android source code. Many online tutorials are from the source code on Google's official website, but recently blue light is not easy to use, FQ efficiency is a bit low, and FQ's network speed is certainly not
Compared with the domestic network speed. Therefore, downloading source code from domestic images is undoubtedly a better choice. There are several images in China, but I finally chose the image of Tsinghua University. Maybe this is the image of the student age.
Feelings have affected me.
After confirming that you want to use the image of Tsinghua University, you should first look for the image tutorial of Tsinghua University. Tutorial: https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/
Download the Android source code according to the tutorial content. There are also several pitfalls in the middle... The download procedure is as follows:
1. Open the terminal
2. Enter the following commands in sequence:
mkdir ~/bin
PATH=~/bin:$PATH
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o ~/bin/repo
#Git repo image using tuna
chmod a+x ~/bin/repo
3. Open the repo file in the bin folder and set
REPO_URL = 'https://gerrit.googlesource.com/git-repo'
Change
REPO_URL = 'https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'
4. Use the updated monthly initialization package. The usage is as follows:
WGet - C https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar ා download initialization package
tar xf aosp-latest.tar
CD AOSP - the project directory of AOSP
#At this time, LS can't see anything, because there is only one hidden. Repo directory
Repo sync - synchronize once to get the complete directory
#Or repo sync - L checkout code only
The initialization package has more than 40 GB, while the network speed was fast last night, and the computer was down. I went to bed first, and got up the next day.
After the last line of command is executed, you can see the source code in the aosp folder. The source code is the latest (Android P). If you want other versions of the source code, you can switch to other branches.
Note: The package is really big. I just set up a 50 GB hard disk for the virtual machine, and it is not enough... It is expanded directly to GB later... (It is basically full after compilation ...)
The download of the source code ends here, and the next step is to compile the source code. The compilation procedure is as follows:
1. Install openjdk1.8
sudo apt-get install openjdk-8-jdk
2. Start Compilation
The source build/envsetup. Sh
Lunch aosp_arm - eng
Make -j8 # (here the number is according to the system configuration, such as 2 core 2 thread can choose j4, the higher the number is compiled faster, the premise of your computer hardware to support... My computer happens to be 8)
After that, it will be a long compilation period... When I came back from dinner, the compilation failed... However, at that time, the computer went down and ignored it. After the restart, the compilation continued. Then... Compiled...
Anyway, compilation passed. It's time to enable simulator verification... Run the following command to open the simulator:
Emulator # exit the terminal, the second time to enter the terminal to execute the command will report an error, this is the reason for the compilation environment, the need to re-execute the command sourcebuild/envsetup. sh; lunchaosp_arm-eng
When the simulator is successfully enabled for the first time, it always requires me to choose to close or wait... Is the source code or Bug of Android P obvious...
The following is a simulator:
Download and compilation are all OK. It is time to close the ticket ~~~