========================================== 如何在 Ubuntu 9.10 下編譯 Android 源碼 ========================================== 問題:Ubuntu 升級爲 9.10, 後 Android 源碼沒法編譯經過怎麼辦? 緣由: 這是 gcc 和 g++ 的版本過高致使的問題。Ubuntu 9.04 是4.3, 而 9.10 是4.4. GCC 在 4.4 時把部份 string 相關的 function 回傳值的 type 改變了... char* 改爲了 const char*... 也所以讓一堆本來不是針對最新的gcc來寫的code都沒法編譯成功。 解決方案:使用舊版本的 gcc 和 g++ 。 一、先下載 gcc-4.3 g++-4.3: apt-get install gcc-4.3 g++-4.3 二、刪除原有的鏈接: sudo rm /usr/bin/gcc 三、添加新的鏈接: sudo ln -s /usr/bin/gcc-4.3 /usr/bin/gcc
更新源,安裝 jdk 1.5。 java_version := $(shell java -version 2>&1 | head -n 1 | grep '[ "]1\.5[\. "$$]') 兩行改爲: java_version := $(shell java -version 2>&1 | head -n 1 | grep '[ "]1\.6[\. "$$]')
javadoc: 錯誤 - 在 doclet 類 DroidDoc 中,方法 start 已拋出異常 java.lang.reflect.InvocationTargetException ================================================== 解決了以上兩個問題以後,按照 Android 官方文檔的方法便可順利進行編譯。分享經驗,分享快樂!放心享受 Ubuntu 9.10 帶給您的驚喜吧! 做者:曾賽 日期:2010-02-25
==================== 1.找不到PRODUCT_POLICY 這部分摘自:http://embeddeder.spaces.live.com/Blog/cns!8006E36532087D51!213.entry 附後:(from http://forum.xda-developers.com/archive/index.php/t-633274.html)web I notice that there is quiet a few people around that are having issues building the source, due to the lack on Sun-Java5 (1.5 JDK) in the Ubuntu Repositories. $ mkdir ~/mydroid $ mkdir mydroid/java5-packages $ cd ~mydroid/java5-packages $ wget http://mirror.pacific.net.au/linux/ubuntu/pool/multiverse/s/sun-java5/sun-java5-jre_1.5.0-18-1_all.deb $ wget http://mirror.pacific.net.au/linux/ubuntu/pool/multiverse/s/sun-java5/sun-java5-bin_1.5.0-18-1_amd64.deb $ wget http://mirror.pacific.net.au/linux/ubuntu/pool/multiverse/s/sun-java5/sun-java5-demo_1.5.0-18-1_amd64.deb $ wget http://mirror.pacific.net.au/linux/ubuntu/pool/multiverse/s/sun-java5/sun-java5-jdk_1.5.0-18-1_amd64.deb $ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev java-common unixodbc $ sudo dpkg -i --ignore-depends=sun-java5-bin sun-java5-jre_1.5.0-18-1_all.deb $ sudo dpkg -i sun-java5-bin_1.5.0-18-1_amd64.deb $ sudo dpkg -i --ignore-depends=sun-java5-jdk sun-java5-demo_1.5.0-18-1_amd64.deb $ sudo dpkg -i sun-java5-jdk_1.5.0-18-1_amd64.deb $ sudo update-java-alternatives -s java-1.5.0-sun $ cd .. $ wget http://android.git.kernel.org/repo $ sudo mv repo /usr/bin/ $ chmod a+x /usr/bin/repo $ repo init -u git://android.git.kernel.org/platform/manifest.git -b eclair $ rep sync $ cd external/webkit/ $ git cherry-pick 18342a41ab72e2c21931afaaab6f1b9bdbedb9fa $ cd ../../ $ wget --referer=http://developer.htc.com/google-io-device.html http://member.america.htc.com/download/RomCode/ADP/signed-google_ion-ota-14721.zip? $ cd vendor/htc/sapphire-open/ $ ./unzip-files.sh $ cd ../../../ $ . build/envsetup.sh $ lunch aosp_sapphire_us-eng $ make That's it? Ok, So it was a lot... Hope this helps someone get the 1.5 JDK on their Ubuntu system (and build eclair) |