標籤:ubuntu
ubuntu14.10上編譯Android5.0.2源碼
2015年04月14日 Android 暫無評論 閱讀2064次ubuntu14.10上編譯Android5.0.2源碼
前面一篇文章說到了ubuntu14.10上Android5.0.2源碼下載的具體步驟,這篇文章說的是ubuntu14.10上編譯Android5.0.2源碼的那些事。
1.先安裝jdk
這裡我使用的是openjdk,網上很多人關於jdk到底使用jdk5、jdk6、jdk7還是openjdk一直在爭論不休,我選擇的是openjdk7,最終證明是可以編譯通過的。
sudo apt-get install openjdk-7-jdk
安裝好後,設定環境變數:
sudo gedit/etc/profile
檔案末尾加上
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/
PATH=PATH:HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH
2.安裝ccache
sudo apt-get install ccache
source ~/.bashrc
3.安裝其他依賴的軟體
勿必提前安裝好,否則編譯時間出錯,會浪費N多時間。
sudo apt-get install git-core
sudo apt-get install git
sudo apt-get install gnupg
sudo apt-get install flex
sudo apt-get install bison
sudo apt-get install gperf
sudo apt-get install build-essential
sudo apt-get install zip
sudo apt-get install curl
sudo apt-get install libc6-dev
sudo apt-get install libncurses5-dev:i386
sudo apt-get install x11proto-core-dev
sudo apt-get install libx11-dev:i386
sudo apt-get install libreadline6-dev:i386
sudo apt-get install libgl1-mesa-dev
sudo apt-get install g++-multilib
sudo apt-get install mingw32
sudo apt-get install tofrodos
sudo apt-get install python-markdown
sudo apt-get install libxml2-utils
sudo apt-get install xsltproc
sudo apt-get install zlib1g-dev:i386
sudo apt-get install dpkg-dev
4.下載其他硬體驅動
到這裡,依賴軟體基本完成,剩下的就根據自己的需求,下載其他硬體驅動了,我是用編譯Nexus6的系統image鏡像,所以還需要下載Nexus6的硬體驅動,詳細可參照這篇文章。
http://jileniao.net/post-154.html
5.進入到源碼目錄
cd android
prebuilts/misc/linux-x86/ccache/ccache -M 50G
6.載入環境變數
. build/envsetup.sh
7.選擇lunch選項
lunch
根據測試機器Nexus6,也就是shamu,所以我選擇的是21
8.開始編譯
make
最終編譯完成,我耗時11小時48分鐘。
Image
host C++: liblatinime_host_static_for_unittests_32 <= packages/inputmethods/LatinIME/native/jni/src/suggest/policyimpl/dictionary/structure/backward/v402/content/shortcut_dict_content.cpp
host C++: liblatinime_host_static_for_unittests_32 <= packages/inputmethods/LatinIME/native/jni/src/suggest/policyimpl/dictionary/structure/backward/v402/content/sparse_table_dict_content.cpp
host C++: liblatinime_host_static_for_unittests_32 <= packages/inputmethods/LatinIME/native/jni/src/suggest/policyimpl/dictionary/structure/backward/v402/content/terminal_position_lookup_table.cpp
host C++: liblatinime_host_static_for_unittests_32 <= packages/inputmethods/LatinIME/native/jni/src/suggest/policyimpl/dictionary/structure/backward/v402/bigram/ver4_bigram_list_policy.cpp
host StaticLib: liblatinime_host_static_for_unittests_32 (out/host/linux-x86/obj32/STATIC_LIBRARIES/liblatinime_host_static_for_unittests_intermediates/liblatinime_host_static_for_unittests.a)
Export includes file: packages/inputmethods/LatinIME/native/jni/HostUnitTests.mk – out/host/linux-x86/obj32/EXECUTABLES/liblatinime_host_unittests_intermediates/export_includes
host Executable: liblatinime_host_unittests (out/host/linux-x86/obj32/EXECUTABLES/liblatinime_host_unittests_intermediates/liblatinime_host_unittests)
make completed successfully (11:48:27 (hh:mm:ss))
編譯中我遇到了編譯到libwebviewchromium.so時停止很長時間最後發生錯誤的問題,解決方案請參照下面這篇文章。
http://jileniao.net/ubunt-add-swap-to-build-libwebviewchromium.html
著作權聲明:本文為博主原創文章,未經博主允許不得轉載。
ubuntu14.10上編譯Android5.0.2源碼