This article was reproduced from: http://blog.csdn.net/zhangmingbao2016/article/details/52699182
Note: The Linux operating system compiled on Android 7.0 must use the Open-jdk,mac OS to use the ORACLEJDK, my is ubuntu16.04, below I have encountered the problem and the solution to make a statement, for reference only:
1, the normal compilation trilogy:
1) Source build/envsetup.sh
2) Lunch 1
3) make-j32 (-j32 means to open 32 threads at the same time compile, depending on the PC configuration, my laptop 8G memory, i5 processor, 256G SSD generally open 10 threads, that is make-j10, the number of threads is a multiple of 2)
Note: Android 7.0 compilation does not need to execute make UPDATE-API, of course execution is not wrong
The problem I encountered:
1) Problem: Computer installation of the OPEN-JDK 1.7, but no configuration environment variables, compile the source code is not detected
Cause: In the build/envsetup.sh file, the function set_java_home () is this:
[Plain]View PlainCopyprint?
- function Set_java_home () {
- # Clear the existing Java_home value if we set it ourselves, so
- # we can reset it later, depending on the version of Java the build
- # system needs.
- #
- # If We don ' t do this, the Java_home value set by the
- # build/envsetup.sh'll persist forever.
- #export legacy_use_java7=1
- If [-N "$ANDROID _set_java_home"]; Then
- Export Java_home= ""
- Fi
- if [! "$JAVA _home"]; Then
- <span style= "color: #FF0000;" >if [-N "$LEGACY _use_java7"]; Then </span>
- echo Warning:support for JDK 7 would be dropped. Switch to JDK 8.
- Case ' uname-s ' in
- Darwin)
- Export java_home=$ (/usr/libexec/java_home-v 1.7)
- ;;
- *)
- Export JAVA_HOME=/USR/LIB/JVM/JAVA-7-OPENJDK-AMD64
- ;;
- Esac
- Else
- Case ' uname-s ' in
- Darwin)
- Export java_home=$ (/usr/libexec/java_home-v 1.8)
- ;;
- *)
- Export JAVA_HOME=/USR/LIB/JVM/JAVA-8-OPENJDK-AMD64
- ;;
- Esac
- Fi
- # Keep track of the fact and we set java_home ourselves, so
- # We can change it on the next envsetup.sh, if required.
- Export Android_set_java_home=true
- Fi
- }
Red code means: If Legacy_use_java7 is not empty, Java_home is set to Java7 path, because legacy_use_java7 we are not assigned, so the compile-time system will only go to find the path of JAVA8, The solution is to add: exportlegacy_use_java7:=1 (for Hoschenmunchen export, because this variable is also used when compiling the environment in BUILD/CORE/MAIN.MK), which is interesting to see.
, so you can compile the environment to detect the link, I also encountered an error in the back: Javac:invalide source release:1.8 (Hope you did not encounter), so far unresolved (if you solve, welcome to share, in Set_java_home () There is a warning: Warning:support for JDK 7 would be dropped. Switch to JDK 8, I do not know if this is the reason), I honestly installed the OPEN-JDK 1.8, after still encountered a problem, see 2).
2) Problem: Locale:cannot set Lc_all to default locale:no such file or directory
Cause: System bug, enter locale in terminal and then enter, output as follows:
locale: Cannot set LC_ALL to default locale: No such file or directoryLANG=en_US.UTF-8LANGUAGE=LC_CTYPE=UTF-8LC_NUMERIC="en_US.UTF-8"LC_TIME="en_US.UTF-8"LC_COLLATE="en_US.UTF-8"LC_MONETARY="en_US.UTF-8"LC_MESSAGES="en_US.UTF-8"LC_PAPER="en_US.UTF-8"LC_NAME="en_US.UTF-8"LC_ADDRESS="en_US.UTF-8"LC_TELEPHONE="en_US.UTF-8"LC_MEASUREMENT="en_US.UTF-8"LC_IDENTIFICATION="en_US.UTF-8"LC_ALL=
Workaround: Before compiling, enter export Lc_all = "en_US in terminal. UTF-8 "Can, of course, be added in envsetup.sh (which has been proven to be possible).
android7.0 compiling problem and resolving "turn"