Android編譯環境折騰記


 一、Ubuntu編譯Android4.4.4

1.平台:realtek RTD2984(Android4.4.4)

  第一次安裝了ubuntu14.04.5,官網下載的iso,官網下的jar,編譯android4.x需要安裝jdk6,更高的版本會有問題,baidu到很多搭建環境的步驟,這個不多說,在win7下使用EasyBCD引導安裝的ubuntu,1TB硬盤果斷裝了雙系統,事實證明沒刪掉win7是個多么明智的決定,在jdk方面,android4.4比4.0要多配置一個javap,其他都一樣

 1 update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_43/bin/java" 1
 2 update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_43/bin/javac" 1
 3 update-alternatives --install "/usr/bin/javadoc" "javadoc" "/usr/lib/jvm/jdk1.6.0_43/bin/javadoc" 1
 4 update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jdk1.6.0_43/jre/lib/amd64/libnpjp2.so" 1
 5 update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.6.0_43/bin/javaws" 1
 6 update-alternatives --install "/usr/bin/javap" "javap" "/usr/lib/jvm/jdk1.6.0_43/bin/javap" 1
 7 update-alternatives --install "/usr/bin/jar" "jar" "/usr/lib/jvm/jdk1.6.0_43/bin/jar" 1
 8 
 9 # Choose the java you installed as default 
10 update-alternatives --config java
11 update-alternatives --config javac
12 update-alternatives --config javadoc
13 update-alternatives --config mozilla-javaplugin.so
14 update-alternatives --config javaws
15 update-alternatives --config javap
16 update-alternatives --config jar

  接下來就是安裝庫文件了,庫文件不能少,不然會報錯缺少xxx中斷編譯,這個比較好處理,缺啥apt-get啥,但是還是在事先就全部安裝好,這編譯一次4.4也不容易,好幾個小時呢

sudo apt-get install git git-core gnupg flex bison gperf build-essential
sudo apt-get install zip curl libc6-dev x11proto-core-dev tofrodos

sudo apt-get install libx11-dev:i386 libreadline6-dev:i386

sudo apt-get install python-markdown libxml2-utils xsltproc zlib1g-dev:i386

sudo apt-get install lib32z1 dos2unix gcc g++ g++-multilib gcc-multilib

sudo apt-get install lib32ncurses5 lib32ncurses5-dev libncurses5-dev libncursesw5-dev lib32ncursesw5-dev

  注:mingw32 libgl1-mesa-glx-lts-quantal:i386 libgl1-mesa-dev-lts-quantal 這三個包我在安裝的時候無法定位,不影響使用

  並且,gcc與g++請再次安裝自己需要的版本

  例如gcc4.7(編譯Android4.4)

sudo apt-get install gcc-4.7 g++-4.7 g++-4.7-multilib gcc-4.7-multilib

   若出現無法定位的錯誤,如在Ubuntu16.04.02上安裝gcc-4.4.7(編譯Android4.0.3),添加源,然后再次安裝gcc版本即可

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update

  但是!!由於我是編譯公司已有的源碼,並不是原生系統源碼,報錯了,第一次是有個文件沒有自動生成!!一個REVISION的變量undefined,於是找到報錯的文件一個一個defined,但是!!!師父的電腦能編譯通過,自動生成的ver.h文件里面包含了REVISION變量的定義,這就有意思了,於是跑到到師父電腦上一查jdk,ubuntu,gcc,g++等版本,jdk有小版本的不同,但這個應該不是關鍵,ubuntu都是14.04的,gcc/g++都是4.8.4,也就是ubuntu14.04自帶的編譯器,然后還有交叉編譯器,這個在源碼中包含了arm-linux-gcc,版本肯定是一樣的,后來碰到有大神說是gcc的版本太高了,可問題是師父的gcc也是4.8啊為什么就不報錯!!!心塞塞。。。改完了這個undefined error,編譯繼續,然后碰到了更多的undefined。。。

  比如plural-exp.h文件中的# define PLURAL_PARSE __gettextparse報conflicting types錯誤

 1 In file included from ../../../binutils-gdb/intl/plural.y:35:0:
 2 ../../../binutils-gdb/intl/plural-exp.h:102:23: error: conflicting types for
 3 'libintl_gettextparse'
 4 # define PLURAL_PARSE libintl_gettextparse
 5                        ^
 6 ../../../binutils-gdb/intl/plural.y:40:25: note: in expansion of macro
 7 'PLURAL_PARSE'
 8 # define __gettextparse PLURAL_PARSE
 9                          ^
10 plural.c:185:5: note: in expansion of macro '__gettextparse'
11 int __gettextparse (void);
12      ^
13 ../../../binutils-gdb/intl/plural-exp.h:102:23: note: previous declaration
14 of 'libintl_gettextparse' was here
15 # define PLURAL_PARSE libintl_gettextparse
16                        ^
17 ../../../binutils-gdb/intl/plural-exp.h:114:12: note: in expansion of macro
18 'PLURAL_PARSE'
19 extern int PLURAL_PARSE PARAMS ((void *arg));
20             ^
21 ../../../binutils-gdb/intl/plural-exp.h:102:23: error: conflicting types for
22 'libintl_gettextparse'
23 # define PLURAL_PARSE libintl_gettextparse
24                        ^
25 ../../../binutils-gdb/intl/plural.y:40:25: note: in expansion of macro
26 'PLURAL_PARSE'
27 # define __gettextparse PLURAL_PARSE
28                          ^
29 plural.c:63:25: note: in expansion of macro '__gettextparse'
30 #define yyparse         __gettextparse
31                          ^
32 plural.c:1130:1: note: in expansion of macro 'yyparse'
33 yyparse (void)
34 ^
35 ../../../binutils-gdb/intl/plural-exp.h:102:23: note: previous declaration
36 of 'libintl_gettextparse' was here
37 # define PLURAL_PARSE libintl_gettextparse
38                        ^
39 ../../../binutils-gdb/intl/plural-exp.h:114:12: note: in expansion of macro
40 'PLURAL_PARSE'
41 extern int PLURAL_PARSE PARAMS ((void *arg));
42             ^
43 plural.c: In function 'libintl_gettextparse':
44 plural.c:1299:7: error: too few arguments to function '__gettextlex'
45        yychar = yylex (&yylval);
46        ^
47 plural.c:64:25: note: declared here
48 #define yylex           __gettextlex
49                          ^
50 ../../../binutils-gdb/intl/plural.y:69:12: note: in expansion of macro
51 'yylex'
52 static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
53             ^
54 ../../../binutils-gdb/intl/plural.y:178:29: error: 'arg' undeclared (first
55 use in this function)
56       ((struct parse_args *) arg)->res = $1;
57                              ^

  對沒錯,就是下面這個鏈接的錯誤!!!

http://stackoverflow.com/questions/33562051/conflicting-types-for-libintl-gettextparse

  網上碰到這個錯誤的還真不多,可能是我運氣真的太好,網上的解決方法是bison版本過低,升級到3.0就好了,屁啊。我的bison版本就是3.0.2,師父的環境也是3.0.2,自己找了好久不了了之。。。

  於是,我默默的格式化了ubuntu系統的所在磁盤,這一刪不得了,因為ubuntu與windows雙系統是ubuntu在進行開機引導的,所以很正常的我開不了機了23333,沒關系,我還可以進U盤的PE系統,咳咳,那個由於我是四五年前的時候給U盤做的啟動盤了,又很正常的PE系統檢測不到公司配的新電腦的硬盤!!這我一下子蒙圈了,網上一搜,原來是U盤PE系統太老了,還好!!我自己電腦還在旁邊,於是又下個laomaotao啥的搞個最新的PE,終於能檢測到硬盤啦,那然后是用U盤直接裝Ubuntu呢還是繼續win7引導,想想就我這運氣還是繼續靠win7吧,用分區工具重寫了grub,這樣又能正常引導開機啦

  以前在學校的時候自己有個arm9的開發版,編過android4.0的系統,編譯環境還是ubuntu12.04,於是這次上官網下了個ubuntu12.04.5,燒寫完畢,重啟,哎呀我去又出大事了!!ubuntu開不了機了。報了個錯網上一搜,說是Thinkpad的bios的設置,不兼容的問題,具體錯誤不太記得了,但是!我還是堅持着又燒寫了一次ubuntu12.04.2,注意這次是2!!!然后神奇的是居然進到桌面了,難道是自己在配置ubuntu12.04.5的時候出了岔子??哎不管了,2與5又有多大的差別呢,又不是14.04,用了會14.04還是覺得14.04好看很多啊!!!(誰讓我是個看顏值的程序猿呢

  這次用ubuntu12.04.2應該沒啥問題了吧,源碼download下來,環境輕車熟路的搭建好,開始編譯!恩,REVISION undefined依然遇到,改過繼續,這次碰到更奇葩的error了!!baidu/google都沒幾個人碰到的啊

  compile_et: Couldn*t find compile_et*s template files

  搜過來搜過去就只有這哥們的帖子( http://tieba.baidu.com/p/3199034286  按照回帖的做了,這庫文件早就是最新的了,所以沒用,沒辦法,只有看Makefile文件了,沒有找到compile_et 的模板文件,是報錯的prof_err.et還是啥??於是用命令compile_et prof_err.et 這個沒報錯啊,於是又編譯一次,還是錯了,看Makefile文件,哦!原來是compile_et --buildtree prof_err.et 這個命令,那確實,會報錯,卡了好久,有次莫名其妙的vi了一下compile_et這個工具,工具???md,原來是shell腳本啊,只讀的shell腳本啊,又是自動生成的shell腳本啊!沒有后綴的compile_et我tm還以為是像windows里的exe工具一樣呢,真是玩windows玩入魔了,這該死的定式思維,然后一個大寫的絕對路徑在里面躺着啊!!這路徑還是師父的路徑啊!!!這個文件就壓根沒有自動生成啊!!!這把我坑的我也不多說什么了,改掉!!!!編譯終於通過了!!測試一下,沒錯!終於跑起來了!!開心啊,然后開開心心的回家了,第二天......

  吃完早餐,開心的打開電腦,然后,1分鍾過去了..5分鍾過去了...10分鍾過去了......ubuntu卡在了用戶登錄之前!!!ubuntu死掉了!!!我去!!!為什么!!!搞了個把小時沒用,各種方法試過,沒用!!決定重裝ubuntu,師父一臉驚呆的問我,你又准備重裝啊?我:......(淚  (這個問題是由於在64位系統上安裝了32位的庫,而12.04安裝32位兼容包有問題。(補充:在Ubuntu14.04和16.04上貌似不會)

  然后心里還是默默的掛念着ubuntu14.04,然后又裝了14.04,真是做死,豪無疑問又碰到了# define PLURAL_PARSE __gettextparse報conflicting types的錯誤,裝的太多次都忘記14.04是這個錯誤了2333,真是為自己捉急!!無奈,為了節省時間只好裝回12.04.2...把上次碰到的錯誤都解決掉,這次成功進入了系統!!!

 

--------------------------------20161028------update-----------

  Ubuntu16.04.1編譯這個項目的時候也碰到這個問題plural-exp.h:94:23: error: conflicting types for 'libintl_gettextparse'

 

-------------------------------20161031-------update-------------

  終於把上述問題(plural.c編譯錯誤)解決啦!!!開心ing....

  果然是bison版本的問題,ubuntu14.04.5執行apt-get install bison得到版本是3.0.2;ubuntu16.04.1執行apt-get install bison得到版本是3.0.4

  然而bison3.0才會報這個錯誤!!!!!!因為今天找師父要了plural.c這個文件(注意在他電腦上編譯是可以通過的,而且這個文件是自動生成的,然后第一句就是這么寫着。

1 /* A Bison parser, made by GNU Bison 2.7.12-4996.  */
2 
3 /* Bison implementation for Yacc-like parsers in C
4    
5       Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.

  bison版本是2.7.1啊啊啊啊啊啊!!!於是我把自己bison版本降到了2.7.1,然后!!!然后!!!成功了!!接着就燒寫,開機,啟動,進入桌面,完美!!

  bison版本變更請移步:http://www.cnblogs.com/pngcui/p/6014896.html

-------------------------------end -----------------------------------

 

總結:經過這么長時間的折騰,以后在也不想再在環境這個問題上搞來搞去了。。。煩人!!系統的文件自己不知道的決不再亂動,萬一就開不了機了。。。

 

這里附上一鍵搭建Android4.4編譯環境的腳本,解壓之后使用腳本

sudo ./auto_install

請務必使用root權限執行,因為壓縮包里包含jdk1.6.0_43.bin文件,執行腳本會自動mv到/usr/lib/jvm/下,這里需要root權限才能執行

   傳送門:http://download.csdn.net/detail/u012062785/9891147

 

 ***************************我是分割線********************************************

2.平台:Mstar648(Android4.4.4)

 --------------------------------------------------20161220 update -----------------------------------

  1.后來在編譯msd6a648的時候報了如下錯誤

bash: ./bin/arm-none-linux-gnueabi-gcc: No such file or directory

  查環境變量的時候發現該路徑存在,且該文件也存在!

  使用命令arm-none-linux-gnueabi-gcc -v 就會報如上錯誤,經baidu后發現是32位庫兼容性問題

  可安裝如下軟件解決問題

sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0

  2.編譯kernel make menuconfig時,報如下錯誤

./mpatch_gen.sh
ConfigName=mpatch.config HeaderName=mpatch_macro.h KconfigName=mpatch_Kconfig DocPath=mstar2/mpatch/doc/ Process mpatch Done... ./gen_cl.sh fatal: Not a git repository (or any of the parent directories): .git HOSTLD scripts/kconfig/mconf /usr/bin/ld: cannot find -lncursesw collect2: error: ld returned 1 exit status make[1]: *** [scripts/kconfig/mconf] Error 1 make: *** [menuconfig] Error 2

  使用ln -s創建鏈接指向x86_64-linux-gnu/libcursesw.so 無用!!!

  可是64位ubuntu已安裝了libncurses5-dev,libncursesw5-dev,lib32ncurses5-dev,突然一想,是不是還有lib32ncursesw5-dev需要安裝阿?!!!!!遂安裝之

sudo apt-get install lib32ncursesw5-dev

  我去,居然成了!,遂記錄之,繼而感嘆真tm坑爹。

 

----------------------------------------------20170208----------------------------------------------------------

  編譯Android報錯

including ./vendor/mstar/supernova/projects/Android.mk ...
Export includes file: external/bluetooth/bluedroid/hci/Android.mk -- out/target/product/generic/obj/SHARED_LIBRARIES/libbt-hci_intermediates/export_includes Export includes file: external/bluetooth/bluedroid/utils/Android.mk -- out/target/product/generic/obj/SHARED_LIBRARIES/libbt-utils_intermediates/export_includes Export includes file: external/bluetooth/bluedroid/gki/Android.mk -- out/target/product/generic/obj/STATIC_LIBRARIES/libbt-brcm_gki_intermediates/export_includes Export includes file: external/bluetooth/bluedroid/bta/Android.mk -- out/target/product/generic/obj/STATIC_LIBRARIES/libbt-brcm_bta_intermediates/export_includes Export includes file: external/bluetooth/bluedroid/stack/Android.mk -- out/target/product/generic/obj/STATIC_LIBRARIES/libbt-brcm_stack_intermediates/export_includes Import includes file: out/target/product/generic/obj/SHARED_LIBRARIES/bluetooth.default_intermediates/import_includes target thumb C++: bluetooth.default <= external/bluetooth/bluedroid/main/../btif/src/btif_config_util.cpp target thumb C: bluetooth.default <= external/bluetooth/bluedroid/main/../btif/src/bluetooth.c external/bluetooth/bluedroid/main/../btif/src/bluetooth.c:415:1: error: missing initializer [-Werror=missing-field-initializers] external/bluetooth/bluedroid/main/../btif/src/bluetooth.c:415:1: error: (near initialization for 'bluetoothInterface.enter_headless_mode') [-Werror=missing-field-initializers] cc1: all warnings being treated as errors make: *** [out/target/product/generic/obj/SHARED_LIBRARIES/bluetooth.default_intermediates/../btif/src/bluetooth.o] 錯誤 1

  最后找到原因的我眼淚掉下來....

  居然是因為在編譯android的之前沒有lunch!!!我的天,還是要細心細心

 

 二、Ubuntu16.04.1編譯Android5.0.1

1.平台:Mstar828(Android5.0.1)

  Android5.x以上需要使用openjdk7,沒有tar,只有deb,只有各種依賴,寶寶心里苦啊。。。折騰一上午決定從ubuntu12.04.4升級到16.04.1,這次又會碰到什么奇葩問題呢?讓我們敬請期待吧,咳咳,Android5.0的編譯與Android4.4的編譯環境只有jdk不一樣,其他是一樣的,gcc采用4.7即可。

  openjdk7安裝方法(由於16.04去掉了openjdk的源,所以加上即可)

sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-7-jdk  

 

---------------------------------------------20160928----------------------------------------第一個error

  Uboot編譯

1 /bin/sh: 1: Syntax error: Missing '))'
2 Makefile:2285: recipe for target 'out/chunk_header.bin' failed

  解決:sudo dpkg-reconfigure dash 選擇no
  原因:http://www.minroad.com/?p=543

 

-------------------------------------------20160928----------------------------------------第二個

  Android 編譯:

1 /home/pngcui/MSD6A828/l-828-0513/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/bin/../lib/gcc/x86_64-linux/4.6/../../../../x86_64-linux/bin/ld: error: out/host/linux-x86/obj32/STATIC_LIBRARIES/libcompiler_rt_intermediates/libcompiler_rt.a(eprintf.o): unsupported reloc 43 against global symbol stderr
2 external/compiler-rt/lib/builtins/eprintf.c:32: error: unsupported reloc 43
3 collect2: ld returned 1 exit status
4 build/core/host_shared_library_internal.mk:44: recipe for target 'out/host/linux-x86/obj32/lib/libcompiler_rt.so' failed
5 make: *** [out/host/linux-x86/obj32/lib/libcompiler_rt.so] Error 1
6 make: *** 正在等待未完成的任務....
7 host C++: dalvikvm_32 <= art/dalvikvm/dalvikvm.cc
8 
9 #### make failed to build some targets (01:27:58 (hh:mm:ss)) ####

  解決:
  1.art/build/Android.common_build.mk中把true改為false

# Host.
ART_HOST_CLANG := false
ifneq ($(WITHOUT_HOST_CLANG),false)          #ture--->false
# By default, host builds use clang for better warnings.
ART_HOST_CLANG := ture
endif

  2.執行命令,更改鏈接指向

ln -sf /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/x86_64-linux/bin/ld

  原因:http://forum.xda-developers.com/chef-central/android/guide-how-to-setup-ubuntu-16-04-lts-t3363669/page2    的15樓  && 19樓

 
----------------------------------------------20160929------------------------------------

  Android編譯:

 1 host C++: dex2oat <= art/dex2oat/dex2oat.cc
 2 In file included from art/runtime/atomic.h:21:0,
 3 from art/runtime/base/mutex.h:26,
 4 from art/runtime/utils.h:28,
 5 from art/runtime/base/histogram.h:23,
 6 from art/runtime/base/timing_logger.h:20,
 7 from art/dex2oat/dex2oat.cc:35:
 8 external/libcxx/include/atomic:539:2: error: #error <atomic> is not implemented
 9 In file included from art/runtime/base/mutex.h:26:0,
10 from art/runtime/utils.h:28,
11 from art/runtime/base/histogram.h:23,
12 from art/runtime/base/timing_logger.h:20,
13 from art/dex2oat/dex2oat.cc:35:
14 art/runtime/atomic.h: In static member function 'static void art::QuasiAtomic::ThreadFenceAcquire()':
15 art/runtime/atomic.h:155:5: error: 'atomic_thread_fence' is not a member of 'std'
16 art/runtime/atomic.h:155:30: error: 'memory_order_acquire' is not a member of 'std'
17 art/runtime/atomic.h: In static member function 'static void art::QuasiAtomic::ThreadFenceRelease()':
18 art/runtime/atomic.h:159:5: error: 'atomic_thread_fence' is not a member of 'std'
19 ...
20 ...
21 cc1plus: all warnings being treated as errors
22 
23 build/core/binary.mk:618: recipe for target 'out/host/linux-x86/obj32/EXECUTABLES/dex2oat_intermediates/dex2oat.o' failed
24 make: *** [out/host/linux-x86/obj32/EXECUTABLES/dex2oat_intermediates/dex2oat.o] Error 1
25 
26 #### make failed to build some targets (04:54 (mm:ss)) ####

  這個問題只怪自己曾經在搭4.4的環境的時候掉進了太多的坑,真是一點也不想動gcc等東西,所以雖然看到官方推薦使用GCC4.7.2,但依舊沒有改(ubuntu16.04默認gcc5.4),在網上搜cc1plus: all warnings being treated as errors這個錯誤,給出的解決方案是注釋掉Makefile文件中的-Werror指令,意思是不把warning當error這又害的我整了好幾個小時去改Makefile文件中的-Werror指令,最后還是安裝了gcc4.7,但是還是報錯,后來就把所有的Makefile文件中的-Werror都注釋掉了,坑爹啊!實際情況並不是這樣子的啊!!

  解決:更新gcc/g++版本為4.7.4,編譯成功。(若已經使用高版本gcc編譯了一次,請重新download一份源碼編譯)
  原因:gcc版本過高,可能對C++的支持不好

 

  Android5.0編譯我用的單線程花了我8個半小時。。。。。。。。以后還是用多線程編比較好,雖然並不穩定

1 #### make completed successfully (08:36:59 (hh:mm:ss)) ####

 

---------------------------------------------------20160930-------------------------------

  kernel  編譯

 1 pngcui@Sky-pngcui:~/MSD6A828/l-828-0513/vendor/mstar/kernel/3.10.40$ make 
 2 HOSTCC scripts/basic/fixdep
 3 /usr/bin/ld: 當搜索用於 /usr/lib/gcc/x86_64-linux-gnu/4.7/libgcc.a 時跳過不兼容的 -lgcc
 4 /usr/bin/ld: 找不到 -lgcc
 5 /usr/bin/ld: 當搜索用於 /usr/lib/gcc/x86_64-linux-gnu/4.7/libgcc_s.so 時跳過不兼容的 -lgcc_s
 6 /usr/bin/ld: 找不到 -lgcc_s
 7 collect2: 錯誤: ld 返回 1
 8 scripts/Makefile.host:118: recipe for target 'scripts/basic/fixdep' failed
 9 make[2]: *** [scripts/basic/fixdep] Error 1
10 /home/pngcui/MSD6A828/l-828-0513/vendor/mstar/kernel/3.10.40/Makefile:453: recipe for target 'scripts_basic' failed
11 make[1]: *** [scripts_basic] Error 2
12 make: *** No rule to make target 'include/config/auto.conf', needed by 'include/config/kernel.release'。 停止。
13 
14 #### make failed to build some targets (1 seconds) ####

  解決:缺少gcc32位庫,執行以下命令

sudo apt-get install g++-4.7-multilib

  搞定!

1 #### make completed successfully (08:44 (mm:ss)) ####

 

-------------------------------------------20171014---update-------------------------------------

 三、Ubuntu16.04.2編譯Android5.1.1

1.平台:全志A64(Android5.1.1)

  編譯Android:

    在解決 collect2: ld returned 1 exit status錯誤后,繼續報如下錯誤

 1 Writing output...
 2 Preparing output jar [/home/pngcui/AW-A64/Android5.1/a64_android5.1/android/out/target/common/obj/APPS/TeleService_intermediates/proguard.classes.jar]
 3   Copying resources from program jar [/home/pngcui/AW-A64/Android5.1/a64_android5.1/android/out/target/common/obj/APPS/TeleService_intermediates/classes.jar]
 4 注: packages/apps/BasicSmsReceiver/tests/src/com/android/basicsmsreceiver/DialogSmsDisplayTests.java使用或覆蓋了已過時的 API。
 5 注: 有關詳細信息, 請使用 -Xlint:deprecation 重新編譯。
 6 target Java: CellBroadcastReceiverTests (out/target/common/obj/APPS/CellBroadcastReceiverTests_intermediates/classes)
 7 Preparing output jar [/home/pngcui/AW-A64/Android5.1/a64_android5.1/android/out/target/common/obj/APPS/TelephonyProvider_intermediates/proguard.classes.jar]
 8   Copying resources from program jar [/home/pngcui/AW-A64/Android5.1/a64_android5.1/android/out/target/common/obj/APPS/TelephonyProvider_intermediates/classes.jar]
 9 Checking API: checkpublicapi-last
10 Checking API: checkpublicapi-current
11 Checking API: checksystemapi-last
12 Checking API: checksystemapi-current
13 out/target/common/obj/PACKAGING/public_api.txt:20: error 5: Added public field android.Manifest.permission.BACKUP
14 out/target/common/obj/PACKAGING/public_api.txt:82: error 5: Added public field android.Manifest.permission.INVOKE_CARRIER_SETUP
15 out/target/common/obj/PACKAGING/public_api.txt:106: error 5: Added public field android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
16 out/target/common/obj/PACKAGING/public_api.txt:116: error 5: Added public field android.Manifest.permission.RECEIVE_EMERGENCY_BROADCAST
17 
18 ******************************
19 You have tried to change the API from what has been previously approved.
20 
21 To make these errors go away, you have two choices:
22    1) You can add "@hide" javadoc comments to the methods, etc. listed in the
23       errors above.
24 
25    2) You can update current.txt by executing the following command:
26          make update-api
27 
28       To submit the revised current.txt to the main Android repository,
29       you will need approval.
30 ******************************
31 
32 
33 
34 make: *** [out/target/common/obj/PACKAGING/checkpublicapi-current-timestamp] 錯誤 38
35 make: *** 正在等待未完成的任務....
36 
37 #### make failed to build some targets (01:57:08 (hh:mm:ss)) ####

        那么根據提示,執行命令即可,然后再繼續make進行編譯

make update-api

 

 

##############20200618  update####################

平台:Android-P以上版本

需求:修改hidl接口,編譯報錯

報錯1:

ERROR: android.hardware.camera.device@1.0::ICameraDevice has hash 0b82b6d63cb098f88756b4fb587df48695cf36d7ab1aadd6ce52d69085d42c17 which does not match hash on record. This interface has been frozen. Do not change it!

原因:Android P開始,Google對Hidl有了嚴格的限制,對Google release出來的hidl接口不允許修改。

解決方案:更新hidl的hash值到hardware/interfaces/current.txt中對應的hidl文件即可,若系統編譯沒有打印出hash值,可以使用如下命令生成

hidl-gen -L hash -r .:hardware/interfaces android.hardware.light@2.0::types

報錯2:

更新hash值之后,繼續make,繼續報錯如下

error: VNDK library: android.hardware.camera.device@1.0's ABI has INCOMPATIBLE CHANGES Please check compatibility report at: out/soong/.intermediates/hardware/interfaces/camera/device/1.0/android.hardware.camera.device@1.0/android_arm_armv7-a-neon_cortex-a7_vendor_shared/android.hardware.camera.device@1.0.so.abidiff
******************************************************
error: Please update ABI references with: $ANDROID_BUILD_TOP/development/vndk/tools/header-checker/utils/create_reference_dumps.py  -l android.hardware.camera.device@1.0

解決方案:更新vndk的api,命令如下:

development/vndk/tools/header-checker/utils/create_reference_dumps.py  -l android.hardware.camera.device@1.0 -products (TARGET_PRODUCT)

注意:需要帶-products參數,后面是編譯TARGET_PRODUCT屬性

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM