編譯之前最好先把需要的包全裝了
sudo apt-get install build-essential make gcc g++ libc6-dev texinfo libncurses-dev git-core gnupg flex bison zip curl ncurses-dev libsdl-dev zlib1g-dev ia32-libs libxml2-utils lzma
1.
build/core/config.mk:365: *** Error: could not find jdk tools.jar, please install JDK6, which you can download from java.sun.com。 停止。
我是配置了Java 環(huán)境變量之后,使用 source /etc/profile使環(huán)境生效,然后直接make,就出現(xiàn)上面的問題,盡管在shell窗口輸入 Java javac等命令顯示的剛才安裝的jdk,這時試著把電腦注銷啟動之后就沒問題了,應該是環(huán)境變量還未真正生效?
2.
build/core/java.mk:258: *** bin: Target java module does not define any source or resource files。 停止。
刪除Android源碼根目錄下的bin目錄,因為自己之前使用了eclipse導入該源碼,eclipse便會生成這個目錄,刪除再make即可。
3.
prebuilts/tools/gcc-sdk/g++: 行 40: prebuilts/tools/gcc-sdk/../../gcc/linux-x86/host/i686-linux-glibc2.7-4.6/bin/i686-linux-g++: 沒有那個文件或目錄make: *** [out/host/linux-x86/obj/EXECUTABLES/validatekeymaps_intermediates/Main.o] 錯誤 127
輸入:
apt-get install g++-multilib
4.
/android4.4/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6/bin/../lib/gcc/i686-linux/4.6.x-google/../../../../i686-linux/bin/as: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directorymake: *** [out/host/linux-x86/obj/EXECUTABLES/validatekeymaps_intermediates/Main.o] 錯誤 1
輸入:
sudo apt-get install apt-file
sudo apt-file update
接著再輸入 make,還是報與上面一樣的錯,網(wǎng)上查找查看鏈接,可以先不輸入 sudp apt-file update。輸入 apt-get install apt-file之后再輸入命令:
apt-file search libz.so
顯示:
lib32z1: /usr/lib32/libz.so.1lib32z1: /usr/lib32/libz.so.1.2.3.3lib32z1-dev: /usr/lib32/libz.solsb-build-base3: /usr/lib/lsb3/libz.sozlib1g: /lib/libz.so.1zlib1g: /lib/libz.so.1.2.3.3zlib1g-dbg: /usr/lib/debug/lib/libz.so.1.2.3.3zlib1g-dbg: /usr/lib/debug/usr/lib32/libz.so.1.2.3.3zlib1g-dev: /usr/lib/libz.so
于是使用 apt-get install 依次安裝上面的模塊,再執(zhí)行make
5.
external/doclava/src/com/google/doclava/Doclava.java:1315: 找不到符號符號: 類 ClassDoc位置: 類 com.google.doclava.Doclava ClassDoc classDoc = (ClassDoc) doc; ^external/doclava/src/com/google/doclava/Doclava.java:1315: 找不到符號符號: 類 ClassDoc位置: 類 com.google.doclava.Doclava ClassDoc classDoc = (ClassDoc) doc; ^external/doclava/src/com/google/doclava/Doclava.java:1324: 找不到符號符號: 類 ClassDoc位置: 類 com.google.doclava.Doclava ClassDoc current = classDoc; ^external/doclava/src/com/google/doclava/Doclava.java:1355: 找不到符號符號: 類 Doc位置: 類 com.google.doclava.Doclava if ((entry instanceof Doc) && isHidden((Doc) entry)) { ^external/doclava/src/com/google/doclava/Doclava.java:1355: 找不到符號符號: 類 Doc位置: 類 com.google.doclava.Doclava if ((entry instanceof Doc) && isHidden((Doc) entry)) { ^external/doclava/src/com/google/doclava/Doclava.java:1391: 找不到符號符號: 類 Type位置: 類 com.google.doclava.Doclava.HideHandler if (proxy instanceof Type && methodName.equals("toString")) {136 錯誤make: *** [out/host/common/obj/JAVA_LIBRARIES/doclava_intermediates/javalib.jar] 錯誤 41
原來是我的jdk環(huán)境配置問題,見stackoverflow
我之前的環(huán)境配置是;
export JAVA_HOME=/usr/local/jdk1.6.0_45export JRE_HOME=/usr/local/jdk1.6.0_45/jreexport CLASSPATH=.:$JAVA_HOME/lib/:$JRE_HOME/lib/:$CLASSPATHexport PATH=$JAVA_HOME/bin/:$JRE_HOME/bin/:$PATH
要改為:
export JAVA_HOME=/usr/local/jdk1.6.0_45export JRE_HOME=/usr/local/jdk1.6.0_45/jreexport CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATHexport PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
注意二者的區(qū)別,改完后的 PATH和CLASSPATH之后的bin和lib后面均沒有 “/”。
6.
prebuilts/misc/linux-x86/bison/bison -d -o out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp frameworks/base/tools/aidl/aidl_language_y.yprebuilts/misc/linux-x86/bison/bison: m4 子進程失敗make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp] 錯誤 1
輸入命令:
sudo apt-get install bison
7.
Lex: aidl <= frameworks/base/tools/aidl/aidl_language_l.l/bin/bash: flex: 未找到命令make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp] 錯誤 127
輸入命令:
sudo apt-get install flex
8.
Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_CSSPropertyNames (out/target/product/generic/obj/GYP/shared_intermediates/blink/CSSPropertyNames.cpp)Traceback (most recent call last): File "scripts/make_css_property_names.py", line 238, in <module> in_generator.Maker(CSSPropertiesWriter).main(sys.argv) File "/android4.4/external/chromium_org/third_party/WebKit/Source/core/scripts/in_generator.py", line 119, in main writer.write_files(options.output_dir) File "/android4.4/external/chromium_org/third_party/WebKit/Source/core/scripts/in_generator.py", line 77, in write_files self._write_file(output_dir, generator(), file_name) File "scripts/make_css_property_names.py", line 233, in generate_implementation gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE) File "/usr/lib/python2.7/subprocess.py", line 679, in __init__ errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child raise child_exceptionOSError: [Errno 2] No such file or directorymake: *** [out/target/product/generic/obj/GYP/shared_intermediates/blink/CSSPropertyNames.cpp] 錯誤 1
這是由于沒有安裝 Git導致的,輸入命令:
sudo apt-get install git
再次make,結(jié)果還是出現(xiàn)同樣的錯誤
干脆把下面的環(huán)境都安裝:
git gnupg flex bison gperf build-essential zip curl libc6-dev x11proto-core-dev g++-multilib tofrodos python-markdown libxml2-utils xsltproc
一個一個安裝,如果已經(jīng)安裝了,ubuntu會自己提示已經(jīng)安裝
9.
Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_HTMLNames (out/target/product/generic/obj/GYP/shared_intermediates/blink/HTMLNames.cpp)sh: 1: /usr/bin/gcc: not foundFailed to read names from file: /android4.4/external/chromium_org/third_party/WebKit/Source/core/html/HTMLTagNames.in at /android4.4/external/chromium_org/third_party/WebKit/Source/core/scripts/make_names.pl line 282.Traceback (most recent call last): File "scripts/action_makenames.py", line 182, in <module> sys.exit(main(sys.argv)) File "scripts/action_makenames.py", line 164, in main assert returnCode == 0AssertionErrormake: *** [out/target/product/generic/obj/GYP/shared_intermediates/blink/HTMLNames.cpp] 錯誤 1
出現(xiàn) sh: 1: /usr/bin/gcc: not found錯誤,難道gcc沒裝,那就裝吧
輸入命令:
sudo apt-get install gcc
啟動模擬器
1.
emulator: ERROR: You did not specify a virtual device name, and the systemdirectory could not be found.If you are an Android SDK user, please use '@<name>' or '-avd <name>'to start a given virtual device (see -help-avd for details).Otherwise, follow the instructions in -help-disk-images to start the emulator
解決:
source build/envsetup.sh
lunch sdk-eng
然后再執(zhí)行
emulator
編譯內(nèi)核
1.
ERROR: include/asm is a directory but a symlink was expectedmake: *** [include/asm] 錯誤 1
解決方法:
刪除源碼根目錄下的include/asm,文件夾,問題解決。
kernel/include/asm 文件夾是內(nèi)核編譯過程中創(chuàng)建的,創(chuàng)建結(jié)果就是一個指向文件夾asm-arm的鏈接,表明該系統(tǒng)的平臺是arm架構(gòu)的,而編譯系統(tǒng)內(nèi)核之前,是沒有asm這個鏈接的,所以,在編譯過程中,創(chuàng)建該鏈接時文件名字與asm文件夾的名字發(fā)生沖突,報錯了。
2.
使用自己編譯的內(nèi)核運行模擬器,結(jié)果
root@lpchou-Lenovo-G450:/android4.4/kernel# emulator -kernel /android4.4/kernel/arch/arm/boot/zImageemulator: WARNING: system partition size adjusted to match image file (550 MB > 200 MB)Failed to load libGL.soerror libGL.so: cannot open shared object file: No such file or directoryFailed to load libGL.soerror libGL.so: cannot open shared object file: No such file or directory
我是用的是 make goldfish_armv7_defconfig 命令來編譯的啊。
報錯解決輸入命令:
sudo apt-get install libgl1-mesa-dev
再次運行模擬器,不會報上面的錯了,但是模擬器還是黑屏。。。
網(wǎng)上搜索,對于android4.4及以后的版本,使用 goldfish2.6的沒用,只有自己去下新的goldfish,于是下載了 goldfish3.4內(nèi)核。
分享地址:http://pan.baidu.com/s/1kTq2BgN
提取碼:4tk3
按照正確的方法在Android4.4上編譯 goldfish3.4內(nèi)核(編譯內(nèi)核還是挺快的),完成后,啟動模擬器,如圖:
聯(lián)系客服