最近修改Android接口,报了一个VNDK的错误
我总结了如下几种方式:
1、直接关闭(不推荐):
在BoardConfig.mk中加入如下两行,可以在编译的时候不去check VNDK,关掉这个可能会导致XTS某些测项跑不过,一般code review也不会给过...
BOARD_VNDK_VERSION :=
BOARD_VNDK_RUNTIME_DISABLE := true
2、粗暴法:
删除如下目录的这些文件
/prebuilts/abi-dumps/vndk
./28/32/arm_armv7-a-neon/source-based/libion.so.lsdump.gz
./28/32/x86/source-based/libion.so.lsdump.gz
./28/64/arm64_armv8-a/source-based/libion.so.lsdump.gz
./28/64/arm_armv8-a/source-based/libion.so.lsdump.gz
./28/64/x86/source-based/libion.so.lsdump.gz
./28/64/x86_64/source-based/libion.so.lsdump.gz
./28/64/x86_x86_64/source-based/libion.so.lsdump.gz
我最终在本地的解法就是进入到/prebuilts/abi-dumps/vndk,搜索libmedia_omx, 将搜索到的libmedia_omx.so.lsdump*全部删除。并重新编译,结果就build pass了。这样也不太好,如果你上代码到服务器,自己这样一搞可以编过,那别人就惨了...
3重新生成(推荐):
其实报错信息有让你去跑一个脚本,之前我也有试过,始终跑不过,找了很多资料,结果少了-products xxx // xxx为boardname,敲如下命令就build pass了,上code到服务器,完美~
development/vndk/tools/header-checker/utils/create_reference_dumps.py -l libmedia_omx -products xxx // xxx为boardname
下面举例说明:
在hardware/interfaces/audio下新增了接口
报了一个VNDK的错误,如下:
意思就是android.hardware.audio.common@5.0::types 的哈希值在hardware/interfaces/current.txt存在,需要更新修改后的哈希值
执行命令:sha256sum ./audio/common/5.0/types.hal ,这里修改那个*.hal文件,就执行 sha256sum xx/xx/xx/*.hal
下面是我新生成的哈希值,发现这个值和上面error的值一样,也许编译时已经计算出
现在将新的值替换到hardware/interfaces/current.txt中对应行
diff --git a/ap/hardware/interfaces/current.txt b/ap/hardware/interfaces/current.txt
index cc15322b83..b4fe40a843 100644
--- a/ap/hardware/interfaces/current.txt
+++ b/ap/hardware/interfaces/current.txt
@@ -3,7 +3,7 @@
# HALs released in Android O
-f219c3b5b8c6cb1d659d4c7328f67246abfe1a8613f469826fd3b9ad090417a2 android.hardware.audio@2.0::IDevice
+22e5355b2038c5d85add396545f72263a927e1ea26154bdde79a94c9a6ef0633 android.hardware.audio@2.0::IDevice
4d579cae1cd87a783fd49233e10ce720ba183cfd1d5ccd80149e69de5c1c7362 android.hardware.audio@2.0::IDevicesFactory
203e23f18011390b8cd10c303e0c16c4eebc8fa187e80e40d6be4624c2b0848a android.hardware.audio@2.0::IPrimaryDevice
aaf93123deec336eb247ad8099849469a541ca0cf7c28c5f5336cebe1ee86748 android.hardware.audio@2.0::IStream
@@ -275,7 +275,7 @@ e29fb1941b40a990676f8e9c676a38761defd890b81a9c034608eb7ba6496023 android.hardwar
b280c4704dfcc548a9bf127b59b7c3578f460c50cce70a06b66fe0df8b27cff0 android.hardware.wifi@1.0::types
# HALs released in Android P
-5860cf040a3d5d771967ecf648b00d06876a7120da985ee2b3e95d01f634dd20 android.hardware.audio@4.0::IDevice
+c686c545135ec399b6fdddd0272b9b92e4e9c9ddbd7ce703d6c1f6f5bff55a24 android.hardware.audio@4.0::IDevice
cf82a0249e918fdc657e189895e92d60af0491868477e82cdc30f6cab0ca2c65 android.hardware.audio@4.0::IDevicesFactory
be3dc9baed45a0d330152eca3ca24fa419b375b20a41644c88d4fb46b72784d2 android.hardware.audio@4.0::IPrimaryDevice
3e3acb70c4e6c7d578f511f4a44ee764ab9126f887a3bf65d523c42e40012bf6 android.hardware.audio@4.0::IStream
重新编译后如果还报错:
需要执行:
development/vndk/tools/header-checker/utils/create_reference_dumps.py -l android.hardware.audio.common@5.0 -products TARGET_PRODUCT
来生成新的android.hardware.audio.common@5.0
例:
development/vndk/tools/header-checker/utils/create_reference_dumps.py -l android.hardware.audio@4.0 -products full_k50v1_64_bsp
他会换原先的,重新编译后通过。