Android source code environment construction
reference:
1. Install Ubuntu16.4 system
2. Openjdk 8 installation
sudo apt-get install openjdk-8-jdk
use java -version
check version
3. Install all packages
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 libgl1-mesa-dev libxml2-utils xsltproc unzip
Source code download
According to the link above, here is the way to choose the local decompression method
Download link address: https://pan.baidu.com/s/1Jwsrb-zwrQO-HEHo5eo9Jg Extraction code: uu1j
Install the decompression tool and decompress
sudo apt-get install p7zip
7zr x android-8.1.0_r1.7z
There is one Sub Items Errors:1
that can be ignored
The directory after decompression is as follows:
compile asop code
1. Execution. build/envsetup.sh
2.lunch
3. Select 6
, aosp_x86_64-eng
, use the simulator to demonstrate
4.make
problems encountered
1. Prompt SSL error
Reference:
The error message is roughly as follows:
Click the link above to modify
sudo vi /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/java.security
Delete the following content
2. QuickSearchBox_intermediates/with-local/classes.dex
Error
Reference:
The compilation path is caused by Chinese. Refer to the following link to change the path to English:
make
After success, the prompt is as follows:
Run emulator
, the emulator window is as follows:
If you turn it off and then run it emulator
, you still need to restart
. build/envsetup.sh
lunch
If there is no modification make
, no modification is required.make
Add log to print on the framework
Referring to the link above, add the following log in the Activity
methodonCreate
edit via vi
cd framework/base
find -name Activity.java
vi ./core/java/android/app/Activity.java
add log
Go back to the root directory:
make framework
make systemimage
After that, emulator
open the emulator, open several Activity
, and filter the log:
illustrate
Android compilation related knowledge can refer to the official website:
1. envsetup.sh
Use envsetup.sh
the script to initialize the environment:
source build/envsetup.sh
or
. build/envsetup.sh
2. lunch
Select lunch
the target to build with