2014-10-31 54 views
1

我想構建android源碼,並得到一個奇怪的錯誤。我選擇使用不正確的Java版本試圖構建android源碼

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

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

的java當我運行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頁,我跑我已刪除了安裝

[email protected]:~/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. 

[email protected]:~/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. 

編輯 所有Java-7從我destkop,我也只安裝sudo apt-get install openjdk-6-jdk。我仍然得到同樣的錯誤。

回答

1

我爲我所有的AOSP和Cyanogenmod建築使用openjdk-6-jdk,而且我從來沒有錯誤。我不確定爲什麼谷歌會一直要求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