Compiling the Environment configuration
Ubuntu17.04 |
Installing OPENJDK (7/8/9) |
sudo apt-get install OPENJDK-8-JDK |
Install Git |
sudo apt-get install git git config--global user.name "accout" git config--global user.email "accout @qq. com" sudo apt-get install repo |
Add dependency |
sudo apt-get install libx11-dev:i386 libreadline6-dev:i386 Libgl1-mesa-dev g++-multilib sudo apt-get install-y git flex bison gperf build-essential libncur Ses5-dev:i386 sudo apt-get install tofrodos python-markdown libxml2-utils xsltproc Zlib1g-dev: I386 sudo apt-get install dpkg-dev libsdl1.2-dev libesd0-dev sudo Apt-get Install Git-core GnuPG Flex Bison gperf build-essential sudo apt-get install zip cur L Zlib1g-dev gcc-multilib g++-multilib sudo apt-get install libc6-dev-i386 Strong>sudo apt-get Install Lib32ncurses5-dev x11proto-core-dev libx11-dev sudo apt-get Install Libgl1-mesa-dev libxml2-utils xsltproc unzip M4 sudo apt-get install Lib32z-dev ccache |
|
|
Get Source code
Android7.1 |
Repo Tool Preparation |
mkdir ~/bin Path=~/bin: $PATH Curl Https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo chmod a+x ~/bin/repo Curl Https://mirrors.tuna.tsinghua.edu.cn/git/git-repo-o Repo chmod +x Repo |
Create source files |
mkdir Source CD source Repo init-u https://aosp.tuna.tsinghua.edu.cn/platform/manifest // Recent versions repo init-u https://aosp.tuna.tsinghua.edu.cn/platform/manifest-b android-7.1.1_r16 // Specify version // Subdivision version nuf26k Repo Sync |
Note |
Repo Init-u https://aosp.tuna.tsinghua.edu.cn/platform/manifest-b android-7.1.1_r16 Repo Init-u git://aosp.tuna.tsinghua.edu.cn/aosp/platform/manifest-b android-7.1.1_r16 Repo Init-u https://aosp.tuna.tsinghua.edu.cn/platform/manifest-b Android-7.1.1_r24 |
Compiling source code
Compile |
Compiling the project |
SOURCE build/envsetup.sh Lunch Aosp_arm64-eng Make-j8 |
Compiling the module |
. build/envsetup.sh m : Compile all the modules mm : Compile the module under the current directory, android.mk file in the current directory mmm : Compiles the module under the specified path, with the Android.mk file under the specified path !!! need to execute before compiling:. build/envsetup.sh, otherwise the error cannot find the command xx Ref:link |
|
|
Reference:
Get Source code
Tsinghua University open source software mirror Station
Codenames, Tags, and Build Numbers mainline version
Network Disk Download
Compile
Build your own Android source code (super verbose)
Build your own Android source learning Environment five: compiling Android code
Burn
Download Android 6.0 source code from Google website, compile and swipe into Nexus 6p phone
Factory Images for Nexus and Pixel Devices
Android-6.0.1_r11 the compilation results into the nexus6p
Ubuntu 14.04 compilation AOSP for Nexus/pixel
Compilation issues
Q1. First compile error (ubuntu14.04-android6.0)
Log:ERROR:Bad request, see Jack server log (/tmp/jack-envy15/jack-8072.log)
Q2. First compile error GC overhead limit exceeded (ubuntu17.04-android7.1)
Key log:
Out of Memory error (version 1.3-rc6 ' Douarn ' (441800 22a11d4b264ae70e366aed3025ef47362d1522bb by [email protected]). GC overhead limit exceeded. Try increasing heap size with Java option '-xmx<size> '. Android-7.1.1_r16 FAILED:/bin/bash OUT/TARGET/COMMON/OBJ/JAVA_LIBRARIES/CORE-ALL_INTERMEDIATES/WITH-LOCAL/CLASSES.DEX.RSP Out of Memory error (version 1.2-RC4 ' Carnac ' (298900 f95d7bdecfceb327f9d201a1348397ed8a843843 by [email protected]). Java Heap space. Try increasing heap size with Java option '-xmx<size> '. Warning:this may have produced partial or corrupted output. |
Solution:
out of Memory error (2 times) |
Method 1 |
Export jack_server_vm_arguments= "-dfile.encoding=utf-8-xx:+tieredcompilation-xmx4096m" Out/host/linux-x86/bin/jack-admin Kill-server Out/host/linux-x86/bin/jack-admin Start-server |
Q3. First compile permission error (ubuntu17.04-android7.1)
Key log:
Opendir failed:. Dbus:permission denied |
Solution:
Permission denied |
Method 1 |
sudo chmod 777 e2670/-R |
Q4. Invalid compile error UTF-8 character (ubuntu17.04-android7.1)
Key log:
Art/runtime/interpreter/unstarted_runtime.cc:1517:1: Error:source file is not valid UTF-8 |
Solution:
UTF-8 Character Set Error |
Method 1 |
Reference Googlo Code correction error Google-code |
Q5. Error Fatal:fork:Cannot Allocate memory (ubuntu17.04-android7.1)
Key log:
[3% 802/22494] install:out/target/p...duct/angler/system/app/music/music.apk Ninja:fatal:fork:Cannot Allocate Memory Build/core/ninja.mk:148:recipe for Target ' Ninja_wrapper ' failed Make: * * * [ninja_wrapper] Error 1 |
Solution:
Unable to allocate memory (2 times) |
Method 1 |
sysctl kernel.pid_max // View maximum number of processes ps-elf | wc–l // View number of running processes // strong> system Recovery After modifying the maximum number of processes echo 1000000 >/proc/sys/kernel/pid_max // takes effect permanently echo "kernel.pid_max=1000000" >>/etc/sysctl.conf sysctl–p Result: No permissions to modify maximum number of processes |
Method 2 |
view virtual machine memory allocation only about 6G, turn off virtual machine memory adjustment to 8G, compile normally. |
REF:
Treatment of-bash:fork:cannot Allocate memory problem
Q6. Communication error with Jack server (52). (ubuntu17.04-android7.1)
Key log:
[14% 3153/21625] Building with Jack: ... K_intermediates/with-local/classes.dex FAILED:/bin/bash OUT/TARGET/COMMON/OBJ/JAVA_LIBRARIES/FRAMEWORK_INTERMEDIATES/WITH-LOCAL/CLASSES.DEX.RSP Communication error with Jack server (52). Try ' Jack-diagnose ' [14% 3153/21625] Target C + +: Sgdisk <= external/gptfdisk/gptcl.cc external/gptfdisk/gptcl.cc:36:29:warning:unused parameter ' filename ' [-wunused-parameter] Gptdatacl::gptdatacl (string filename) { ^ external/gptfdisk/gptcl.cc:109:43:warning:missing field ' descrip ' initializer [-wmissing-field-initializers] popt_autohelp {null, 0, 0, NULL, 0} ^ 2 warnings generated. Ninja:build Stopped:subcommand failed. Build/core/ninja.mk:148:recipe for Target ' Ninja_wrapper ' failed Make: * * * [ninja_wrapper] Error 1 |
Solution:
Communication error with Jack server |
Method 1 |
Jack-admin Start-server Launching Jack server Java-xx:maxjavastacktracedepth=-1-djava.io.tmpdir=/tmp-dfile.encoding=utf-8-XX:+ Tieredcompilation-cp/home/galian/.jack-server/launcher.jar Com.android.jack.launcher.ServerLauncher Result: Command not found |
Method 2 |
Jack-admin Start-server Ref:link |
REF:
Build your own Android source learning Environment five: compiling Android code
Android7.0 Jack compiler does not support multi-user simultaneous compilation problem resolution
Q7. The program ' mm ' was currently not installed. (ubuntu17.04-android7.1)
Key log:
The program ' mm ' was currently not installed. You can install it by typing: sudo apt install multimail |
Workaround:
. build/envsetup.sh
REF:
Using MM/MMM to prepare for work
Reference:
AOSP
Codenames, Tags, and Build Numbers mainline version
AOSP android7.1.1-r16 Source Code compilation