android7.0 compiling problem and resolving "turn"

Source: Internet
Author: User

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?
  1. function Set_java_home () {
  2. # Clear the existing Java_home value if we set it ourselves, so
  3. # we can reset it later, depending on the version of Java the build
  4. # system needs.
  5. #
  6. # If We don ' t do this, the Java_home value set by the
  7. # build/envsetup.sh'll persist forever.
  8. #export legacy_use_java7=1
  9. If [-N "$ANDROID _set_java_home"]; Then
  10. Export Java_home= ""
  11. Fi
  12. if [! "$JAVA _home"]; Then
  13. <span style= "color: #FF0000;" >if [-N "$LEGACY _use_java7"]; Then </span>
  14. echo Warning:support for JDK 7 would be dropped. Switch to JDK 8.
  15. Case ' uname-s ' in
  16. Darwin)
  17. Export java_home=$ (/usr/libexec/java_home-v 1.7)
  18. ;;
  19. *)
  20. Export JAVA_HOME=/USR/LIB/JVM/JAVA-7-OPENJDK-AMD64
  21. ;;
  22. Esac
  23. Else
  24. Case ' uname-s ' in
  25. Darwin)
  26. Export java_home=$ (/usr/libexec/java_home-v 1.8)
  27. ;;
  28. *)
  29. Export JAVA_HOME=/USR/LIB/JVM/JAVA-8-OPENJDK-AMD64
  30. ;;
  31. Esac
  32. Fi
  33. # Keep track of the fact and we set java_home ourselves, so
  34. # We can change it on the next envsetup.sh, if required.
  35. Export Android_set_java_home=true
  36. Fi
  37. }

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"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.