[原]編譯Android源碼過程當中遇到的問題

編譯Android源碼的過程參考Android官網介紹:html

一、下載Android源碼的步驟:https://source.android.com/source/downloading.htmljava

二、編譯Android源碼的步驟:https://source.android.com/source/building-running.htmlpython

 

下面就是我遇到的一些問題:android

一、Compile Android Source時JDK相關的錯誤:git

錯誤1:
target release 1.5 conflicts with default source release 1.7 
 
解決辦法:最好使用jdk爲1.6.0.45的版本
 
錯誤2:
 [out/target/common/obj/JAVA_LIBRARIES/core_intermediates/classes-full-debug.jar] Error 41
 
解決辦法:jdk版本太低,將jdk版本升級到1.6.0.45
 
 
二、Linux下修改經過命令行安裝的jdk,使用本身安裝的jdk
sudo update-alternatives --install /usr/bin/jar jar /opt/java/jdk1.6.0_45/bin/jar 60
sudo update-alternatives --install /usr/bin/java java /opt/java/jdk1.6.0_45/bin/java 60
sudo update-alternatives --install /usr/bin/javac javac /opt/java/jdk1.6.0_45/bin/javac 60
sudo update-alternatives --install /usr/bin/javap javap /opt/java/jdk1.6.0_45/bin/javap 60
sudo update-alternatives --install /usr/bin/javadoc javadoc /opt/java/jdk1.6.0_45/bin/javadoc 60
    
sudo update-alternatives --config jar 
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javap
sudo update-alternatives --config javadoc
 
當你config的時候會有以下提示:
There are 2 choices for the alternative jar (providing /usr/bin/jar).

Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-7-openjdk-amd64/bin/jar 1071 auto mode
* 1 /opt/java/jdk/bin/jar 60 manual mode
2 /usr/lib/jvm/java-7-openjdk-amd64/bin/jar 1071 manual mode
Press enter to keep the current choice[*], or type selection number:
 
按照提示選擇你所對應的路徑的number便可。
 
三、Ubuntu 14.04 Android 4.4.2編譯出錯 OSError: [Errno 2] No such file or directory
  錯誤:
   [out/target/product/generic/obj/GYP/shared_intermediates/blink/CSSValueKeywords.cpp] 錯誤 1
  解決方法:把以下所需的系統環境都安裝上從新編譯便可:
   git gnupg flex bison gperf build-essential  zip  curl  libc6-dev  libncurses5-dev:i386  x11proto-core-dev  libx11-dev:i386  libreadline6-dev:i386  g++-multilib
   mingw32  tofrodos  python-markdown  libxml2-utils  xsltproc  zlib1g-dev:i386  

  如安裝git,以下,其餘也是同樣,一個個安裝便可。markdown

  sudo apt-get install gitoracle

 

最後若是出現以下輸出,則表示安裝成功:curl

Installed system fs image:out/target/product/generic/system.imgjvm

Target ram disk: out/target/product/generic/ramdisk.imgflex

Target userdata fs image: out/target/product/generic/userdata.img

Installed file list: out/target/product/generic/installed-files.txt

相關文章
相關標籤/搜索