欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

aosp 编译 automotive 中遇到的问题

程序员文章站 2023-03-08 17:20:55
编译1[ 66% 66975/100143] AAPT2 link out/target/product/generic_x86_64/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/package-res.apkFAILED: out/target/product/generic_x86_64/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/pa...

编译

1

[ 66% 66975/100143] AAPT2 link out/target/product/generic_x86_64/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/package-res.apk
FAILED: out/target/product/generic_x86_64/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/package-res.apk out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/aapt2.srcjar out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/extra_packages out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/src/R.stamp out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/proguard_options
/bin/bash -c "(rm -rf out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/aapt2 ) && (mkdir -p out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/aapt2 ) && (rm -f out/target/product/generic_x86_64/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/aapt2-flat-list ) && (touch out/target/product/generic_x86_64/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/aapt2-flat-list ) && (echo -n 'out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/flat-res/packages/services/Car/car_product/overlay/frameworks/base/packages/CarSystemUI/res/values-h600dp_dimens.arsc.flat out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/flat-res/packages/services/Car/car_product/overlay/frameworks/base/packages/CarSystemUI/res/values-sw600dp_dimens.arsc.flat out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/flat-res/packages/services/Car/car_product/overlay/frameworks/base/packages/CarSystemUI/res/values-w1024dp_dimens.arsc.flat out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/flat-res/packages/services/Car/car_product/overlay/frameworks/base/packages/CarSystemUI/res/values-w550dp-land_dimens.arsc.flat out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/flat-res/packages/services/Car/car_product/overlay/frameworks/base/packages/CarSystemUI/res/values_config.arsc.flat out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/flat-res/packages/services/Car/car_product/overlay/frameworks/base/packages/CarSystemUI/res/values_dimens.arsc.flat ' >> out/target/product/generic_x86_64/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/aapt2-flat-list ) && (rm -f out/target/product/generic_x86_64/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/aapt2-flat-overlay-list ) && (touch out/target/product/generic_x86_64/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/aapt2-flat-overlay-list ) && (echo -n 'out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/flat-res/device/generic/goldfish/overlay/frameworks/base/packages/SystemUI/res/values_config.arsc.flat out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/flat-res/packages/services/Car/car_product/overlay/frameworks/base/packages/SettingsLib/res/values_dimens.arsc.flat out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/flat-res/packages/services/Car/car_product/overlay/frameworks/base/packages/SettingsLib/res/values_styles.arsc.flat ' >> out/target/product/generic_x86_64/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/aapt2-flat-overlay-list ) && (out/soong/host/linux-x86/bin/aapt2 link -o out/target/product/generic_x86_64/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/package-res.apk --auto-add-overlay --no-resource-deduping --no-resource-removal -z --no-static-lib-packages  --manifest out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/manifest/AndroidManifest.xml -I out/target/common/obj/APPS/framework-res_intermediates/package-export.apk   --java out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/aapt2 --proguard out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/proguard_options --min-sdk-version S --target-sdk-version S --product emulator -c en_US,af_ZA,am_ET,ar_EG,bg_BG,bn_BD,ca_ES,cs_CZ,da_DK,de_DE,el_GR,en_AU,en_GB,en_IN,es_ES,es_US,et_EE,eu_ES,fa_IR,fi_FI,fr_CA,fr_FR,gl_ES,hi_IN,hr_HR,hu_HU,hy_AM,in_ID,is_IS,it_IT,iw_IL,ja_JP,ka_GE,km_KH,ko_KR,ky_KG,lo_LA,lt_LT,lv_LV,km_MH,kn_IN,mn_MN,ml_IN,mk_MK,mr_IN,ms_MY,my_MM,ne_NP,nb_NO,nl_NL,pl_PL,pt_BR,pt_PT,ro_RO,ru_RU,si_LK,sk_SK,sl_SI,sr_RS,sv_SE,sw_TZ,ta_IN,te_IN,th_TH,tl_PH,tr_TR,uk_UA,vi_VN,zh_CN,zh_HK,zh_TW,zu_ZA,en_XA,ar_XB,en_US,af_ZA,am_ET,ar_EG,ar_XB,as_IN,az_AZ,be_BY,bg_BG,bn_BD,bs_BA,ca_ES,cs_CZ,da_DK,de_DE,el_GR,en_AU,en_CA,en_GB,en_IN,en_XA,es_ES,es_US,et_EE,eu_ES,fa_IR,fi_FI,fr_CA,fr_FR,gl_ES,gu_IN,hi_IN,hr_HR,hu_HU,hy_AM,in_ID,is_IS,it_IT,iw_IL,ja_JP,ka_GE,kk_KZ,km_KH,kn_IN,ko_KR,ky_KG,lo_LA,lt_LT,lv_LV,mk_MK,ml_IN,mn_MN,mr_IN,ms_MY,my_MM,nb_NO,ne_NP,nl_NL,or_IN,pa_IN,pl_PL,pt_BR,pt_PT,ro_RO,ru_RU,si_LK,sk_SK,sl_SI,sq_AL,sr_Latn_RS,sr_RS,sv_SE,sw_TZ,ta_IN,te_IN,th_TH,tl_PH,tr_TR,uk_UA,ur_PK,uz_UZ,vi_VN,zh_CN,zh_HK,zh_TW,zu_ZA,  --version-code 29 --version-name S   -R \\@out/target/product/generic_x86_64/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/aapt2-flat-overlay-list \\@out/target/product/generic_x86_64/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/aapt2-flat-list ) && (out/soong/host/linux-x86/bin/soong_zip -o out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/aapt2.srcjar -C out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/aapt2 -D out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/aapt2 ) && (out/soong/host/linux-x86/bin/extract_jar_packages -i out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/aapt2.srcjar -o out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/extra_packages --prefix '--extra-packages ' ) && (rm -f out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/src/R.stamp ) && (for GENERATED_MANIFEST_FILE in \`find out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/aapt2 -name Manifest.java 2> /dev/null\`; do dir=\`awk '/package/{gsub(/\\./,\"/\",\$2);gsub(/;/,\"\",\$2);print \$2;exit}' \$GENERATED_MANIFEST_FILE\`; mkdir -p out/target/common/R/\$dir; cp \$GENERATED_MANIFEST_FILE out/target/common/R/\$dir; done ) && (for GENERATED_R_FILE in \`find out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/aapt2 -name R.java 2> /dev/null\`; do dir=\`awk '/package/{gsub(/\\./,\"/\",\$2);gsub(/;/,\"\",\$2);print \$2;exit}' \$GENERATED_R_FILE\`; mkdir -p out/target/common/R/\$dir; cp \$GENERATED_R_FILE out/target/common/R/\$dir || exit 31; cp \$GENERATED_R_FILE out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/src/R.stamp || exit 32; done ) && (touch out/target/common/obj/APPS/CarSystemUI__auto_generated_rro_product_intermediates/src/R.stamp )"
packages/services/Car/car_product/overlay/frameworks/base/packages/CarSystemUI/res/values/config.xml:108: error: resource string/config_systemUIVendorServiceComponent (aka com.android.systemui.auto_generated_rro_product__:string/config_systemUIVendorServiceComponent) not found.
error: failed linking references.
14:01:40 ninja failed with: exit status 1

查找 config_systemUIVendorServiceComponent 字符串使用位置

grep -rn config_systemUIVendorServiceComponent

在对应的res/values目录下的strings.xml文件中添加config_systemUIVendorServiceComponent 字串

2

frameworks/base/wifi/java/android/net/wifi/p2p/WifiP2pManager.java:26: info: Unresolved import: `android.compat.annotation.UnsupportedAppSDK: warning: including GNU target out/target/product/generic_x86/system/lib/libext2fs.so
SDK: warning: including GNU target out/target/product/generic_x86/system/lib/libiprouteutil.so
SDK: warning: including GNU target out/target/product/generic_x86/system/lib/liblz4.so
SDK: warning: including GNU target out/target/product/generic_x86/system/lib/libnetlink.so
SDK: warning: including GNU target out/target/product/generic_x86/system/lib/libnl.so
SDK: warning: including GNU target out/target/product/generic_x86/system/lib/libselinux.so
development/build/sdk-linux-x86.atree:36: couldn't locate source file: lib64/libaapt2_jni.so
09:32:52 ninja failed with: exit status 1

#### failed to build some targets (06:36 (mm:ss)) ####

注释掉 development/build/sdk-linux-x86.atree 中第 36 行

3

OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000772f00000, 258998272, 0) failed; error='Not enough space' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 258998272 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /mnt/aa8c810e-8696-44ac-8c7a-3ba8e44b5c8f/AOSP/hs_err_pid16321.log
[ 92% 73625/79927] //frameworks/base:hiddenapi-lists-docs Metalava
[ 92% 73626/79927] //frameworks/base:system-api-stubs-docs Metalava
[ 92% 73627/79927] //frameworks/base:test-api-stubs-docs Metalava
ninja: build stopped: subcommand failed.
13:00:21 ninja failed with: exit status 1

#### failed to build some targets (03:15:07 (hh:mm:ss)) ####

4. make sdk sdk_repo 过程中错误

development/build/sdk-linux-x86.atree:36: couldn't locate source file: lib64/libaapt2_jni.so
development/build/sdk.atree:53: couldn't locate source file: bin/dmtracedump
development/build/sdk.atree:54: couldn't locate source file: bin/etc1tool
development/build/sdk.atree:58: couldn't locate source file: system/framework/deployagent.jar
development/build/sdk.atree:59: couldn't locate source file: system/bin/deployagent
development/build/sdk.atree:85: couldn't locate source file: bin/aapt
development/build/sdk.atree:88: couldn't locate source file: bin/split-select
development/build/sdk.atree:93: couldn't locate source file: bin/bcc_compat
development/build/sdk.atree:138: couldn't locate source file: bin/apksigner
development/build/sdk.atree:139: couldn't locate source file: framework/apksigner.jar
development/build/sdk.atree:142: couldn't locate source file: bin/dx
development/build/sdk.atree:143: couldn't locate source file: framework/dx.jar
development/build/sdk.atree:220: couldn't locate source file: framework/layoutlib-legacy.jar
18:22:19 ninja failed with: exit status 1

#### failed to build some targets (23:58 (mm:ss)) ####

使用make命令分别编译缺少的工具

 make dmtracedump etc1tool

运行

5

将编译出来的sdk-repo-linux-system-images-eng.simon.zip文件解压到~/Library/Android/sdk/system-images/android-29/ 目录

模仿其它虚拟机的 package.xml文件,在虚拟机目录下添加(未运行)、修改(运行过)package.xml文件

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ns2:repository xmlns:ns2="http://schemas.android.com/repository/android/common/01" xmlns:ns3="http://schemas.android.com/repository/android/generic/01" xmlns:ns4="http://schemas.android.com/sdk/android/repo/addon2/01" xmlns:ns5="http://schemas.android.com/sdk/android/repo/repository2/01" xmlns:ns6="http://schemas.android.com/sdk/android/repo/sys-img2/01"><license id="license-3EC61E2D" type="text"/><localPackage path="system-images;android-29;android-automotive;x86" obsolete="false"><type-details xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns6:sysImgDetailsType"><api-level>29</api-level><codename>S</codename><tag><id>android-automotive</id><display>Automotive x86</display></tag><abi>x86</abi></type-details><revision><major>6</major></revision><display-name>Intel x86 Atom System Image</display-name><uses-license ref="license-3EC61E2D"/></localPackage></ns2:repository>

6

2020-07-01 10:04:19.220 4124-4124/? E/System: ******************************************
2020-07-01 10:04:19.220 4124-4124/? E/System: ************ Failure starting system services
    java.lang.IllegalStateException: Signature|privileged permissions not in privapp-permissions whitelist: {com.android.car.developeroptions: android.permission.READ_PRIVILEGED_PHONE_STATE}
        at com.android.server.pm.permission.PermissionManagerService.systemReady(PermissionManagerService.java:2983)
        at com.android.server.pm.permission.PermissionManagerService.access$100(PermissionManagerService.java:122)
        at com.android.server.pm.permission.PermissionManagerService$PermissionManagerServiceInternalImpl.systemReady(PermissionManagerService.java:3044)
        at com.android.server.pm.PackageManagerService.systemReady(PackageManagerService.java:21192)
        at com.android.server.SystemServer.startOtherServices(SystemServer.java:2042)
        at com.android.server.SystemServer.run(SystemServer.java:537)
        at com.android.server.SystemServer.main(SystemServer.java:363)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:906)
2020-07-01 10:04:19.220 4124-4124/? D/SystemServerTiming: MakePackageManagerServiceReady took to complete: 415ms

添加权限白名单, 在下面文件中添加权限,并重新打包 make sdk sdk_repo

frameworks/base/data/etc/car/com.android.car.developeroptions.xml

最终

最后通过更新代码库tag后,重新编译,以上问题除问题4其它问题都解决。

本文地址:https://blog.csdn.net/tzshlyt/article/details/107165407