尝试构建android源时,java版本不正确

时间:2014-10-31 08:54:59

标签: android-source

我正在尝试构建android源代码,并且遇到了一个奇怪的错误。我选择了使用

的java
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac

$ update-alternatives --config java
$ update-alternatives --config javac

当我运行make -j4时,我得到了

Your version is: java version "1.7.0_72".
The correct version is: Java SE 1.6.

当我运行sudo make -j4时,我得到了

Your version is: java version "1.6.0_33".
The correct version is: Java SE 1.6.

android source page

Please follow the machine setup instructions at
    https://source.android.com/source/download.html

OPENJDK页面上,我运行了安装

jsiddharth@TheDEN:~/workspace/androidsource$ sudo apt-get install openjdk-6-jre
Reading package lists... Done
Building dependency tree       
Reading state information... Done
openjdk-6-jre is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.

jsiddharth@TheDEN:~/workspace/androidsource$ sudo apt-get install openjdk-6-jdk
Reading package lists... Done
Building dependency tree       
Reading state information... Done
openjdk-6-jdk is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.

修改 我已经从我的destkop中删除了所有java-7,而且我只安装了sudo apt-get install openjdk-6-jdk。我仍然得到同样的错误。

1 个答案:

答案 0 :(得分:1)

我将openjdk-6-jdk用于我的所有AOSP和Cyanogenmod建筑,我从未遇到任何错误。我不确定谷歌为什么要继续要求Oracle的东西,但恕我直言,这不仅仅是技术性的。所以我的建议是在makefile build / core / main.mk中评论错误的产生(看看'#'评论):

ifeq ($(strip $(java_version)),)
$(info ************************************************************)
$(info You are attempting to build with the incorrect version)
$(info of java.)
$(info $(space))
$(info Your version is: $(java_version_str).)
$(info The required version is: $(required_version))
$(info $(space))
$(info Please follow the machine setup instructions at)
$(info $(space)$(space)$(space)$(space)https://source.android.com/source/initializing.html)
$(info ************************************************************)
#$(error stop)
endif