错误:
============================================
Checking build tools versions...
************************************************************
You are attempting to build with the incorrect version
of java.
Your version is: Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar java version "1.7.0_80" Java(TM) SE Runtime Environment (build 1.7.0_80-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11,mixed mode).
The required version is: "1.7.x"
Please follow the machine setup instructions at
https://source.android.com/source/initializing.html
************************************************************
build/core/main.mk:174: *** stop. Stop.
#### make Failed to build some targets (1 seconds) ####
java -version:
$java -version
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11,mixed mode)
javac -version:
$javac -version
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
javac 1.7.0_80
$sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 auto mode
1 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode
* 2 /usr/lib/jvm/java-7-oracle/jre/bin/java 1 manual mode
$sudo update-alternatives --config javac
There are 2 choices for the alternative javac (providing /usr/bin/javac).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-7-openjdk-amd64/bin/javac 1071 auto mode
1 /usr/lib/jvm/java-7-openjdk-amd64/bin/javac 1071 manual mode
* 2 /usr/lib/jvm/java-7-oracle/bin/javac 1 manual mode
最佳答案
对于那些想要通过KitKat构建Gingerbread(需要Oracle JDK 1.6)但已经为Lollipop(JDK 1.7)配置系统的人,这是更新系统的最简单方法:
原文链接:https://www.f2er.com/android/431292.html首先为更新的Java构建添加PPA.
sudo add-apt-repository ppa:webupd8team/java
然后安装:
sudo apt-get update && sudo apt-get install oracle-java6-installer
完成后,您只需告诉Linux使用旧版本的Java和Java Compiler来呈现内容.
分别运行以下两个命令,在提示时两次正确选择Oracle JDK 1.6.再次在终端:
sudo update-alternatives --config java
sudo update-alternatives --config javac