閱讀325 返回首頁    go 阿裏雲 go 技術社區[雲棲]


android源碼編譯錯誤總結

android源碼編譯及錯誤解決:

下載的源碼,進入源碼目錄,執行make命令即可。

加快源碼編譯:make -jN,cpu有幾個核N就填幾

不過其中會有一些錯誤,下麵是我編譯中出現的錯誤,解決非常的簡單;


編譯源碼中遇到的錯誤:

貼出來一個個解決:

綠色:表示找出問題

Yacc: aidl <= frameworks/base/tools/aidl/aidl_language_y.y
bison -d  -o out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp frameworks/base/tools/aidl/aidl_language_y.y
/bin/bash: bison: command not found
make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp] Error 127
解決方法:sudo apt-get install bison



Lex: aidl <= frameworks/base/tools/aidl/aidl_language_l.l
/bin/bash: flex: command not found
make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp] Error 127

解決方法:sudo apt-get install flex


host C: adb <= system/core/adb/fdevent.c
host Executable: adb (out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb)
/usr/bin/ld: cannot find -lncurses
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb] Error 1

原因:/usr/bin/ld: cannot find -lncurses
collect2: ld 返回 1 

首先到usr/lib/目錄下尋找libncurses開頭的文件
1.如果沒有那就是缺少庫文件
解決方法:

$ sudo apt-cache search ncurses-
有這樣一個結果:
libncurses5-dev - developer's libraries and docs for ncurses

安裝libncurses

解決方法:sudo apt-get install libncurses5-dev


Install: out/target/product/generic/system/lib/libttssynthproxy.so
Generating CSSPropertyNames.h <= CSSPropertyNames.in
sh: gperf: not found
calling gperf failed: 32512 at ./makeprop.pl line 96.
make: *** [out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/WebCore/css/CSSPropertyNames.h] Error 25
make: *** Deleting file `out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/WebCore/css/CSSPropertyNames.h'

解決方法:sudo apt-get install gperf


解決完這些錯誤,就可以編譯完android源碼了。不過是要花費點時間的。

編譯完成後,在你的源碼目錄下會有一個out文件,你可以查看是否編譯成功了。



最後更新:2017-04-02 16:47:52

  上一篇:go webview可以獲取網頁源碼,進行重新排版嗎
  下一篇:go Android使用TextView實現無下劃線超鏈接