Android P VNDK报错

Posted 他叫小黑

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Android P VNDK报错相关的知识,希望对你有一定的参考价值。

最近修改android接口,报了一个VNDK的错误,如下

按照提示执行development/vndk/tools/header-checker/utils/create_reference_dumps.py -l android.hardware.gnss@1.0。执行不通过,报了如下错误:

$ development/vndk/tools/header-checker/utils/create_reference_dumps.py -l android.hardware.gnss@1.0
Traceback (most recent call last):
  File "development/vndk/tools/header-checker/utils/create_reference_dumps.py", line 224, in <module>
    main()
  File "development/vndk/tools/header-checker/utils/create_reference_dumps.py", line 210, in main
    targets = [Target(True, product), Target(False, product)]
  File "development/vndk/tools/header-checker/utils/create_reference_dumps.py", line 29, in __init__
    self.arch = build_vars[1]
IndexError: list index out of range

这个报错是因为环境的错误。
执行一下ls -l /bin/sh,查看用的是什么来解释执行Python脚本。

$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 4月   2  2019 /bin/sh -> dash

我本地的用dash来解释执行Python脚本,所以报错了,得用bash。
执行sudo dpkg-reconfigure dash指令可以切换成bash。
继续执行,发现还是报错了!如下

$ development/vndk/tools/header-checker/utils/create_reference_dumps.py -l android.hardware.gnss@1.0
Removing reference dumps...
removing /platform/prebuilts/abi-dumps/vndk/28/32/arm_armv7-a-neon/source-based/android.hardware.gnss@1.0.so.lsdump.gz
removing /platform/prebuilts/abi-dumps/ndk/28/32/arm_armv7-a-neon/source-based/android.hardware.gnss@1.0.so.lsdump.gz
making libs for product: aosp_arm_ab
Traceback (most recent call last):
  File "development/vndk/tools/header-checker/utils/create_reference_dumps.py", line 224, in <module>
    main()
  File "development/vndk/tools/header-checker/utils/create_reference_dumps.py", line 215, in main
    make_libs_for_product(args.libs, args.llndk, product)
  File "development/vndk/tools/header-checker/utils/create_reference_dumps.py", line 97, in make_libs_for_product
    make_libraries(libs, product, llndk_mode)
  File "/platform/development/vndk/tools/header-checker/utils/utils.py", line 146, in make_libraries
    make_targets(lib_targets, product)
  File "/platform/development/vndk/tools/header-checker/utils/utils.py", line 137, in make_targets
    stderr=subprocess.STDOUT)
  File "/usr/lib/python3.5/subprocess.py", line 581, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['build/soong/soong_ui.bash', '--make-mode', '-j', 'android.hardware.gnss@1.0.vendor', 'TARGET_PRODUCT=aosp_arm_ab']' returned non-zero exit status 1

看到making libs for product: aosp_arm_ab这行,这个是因为我的项目product名字不一样导致的,加上参数-product product_name即可,product_name是你的项目的product名称。

$ development/vndk/tools/header-checker/utils/create_reference_dumps.py -l android.hardware.gnss@1.0 -product product_name
Removing reference dumps...
removing platform/prebuilts/abi-dumps/vndk/28/64/arm_armv8-a/source-based/android.hardware.gnss@1.0.so.lsdump.gz
removing /platform/prebuilts/abi-dumps/ndk/28/64/arm_armv8-a/source-based/android.hardware.gnss@1.0.so.lsdump.gz
removing /platform/prebuilts/abi-dumps/vndk/28/64/arm64_armv8-a/source-based/android.hardware.gnss@1.0.so.lsdump.gz
removing /platform/prebuilts/abi-dumps/ndk/28/64/arm64_armv8-a/source-based/android.hardware.gnss@1.0.so.lsdump.gz
making libs for product: product_name
Creating dumps for target_arch: arm and variant  armv8-a
Created abi dump at  /platform/prebuilts/abi-dumps/vndk/28/64/arm_armv8-a/source-based/android.hardware.gnss@1.0.so.lsdump.gz
Creating dumps for target_arch: arm64 and variant  armv8-a
Created abi dump at  /platform/prebuilts/abi-dumps/vndk/28/64/arm64_armv8-a/source-based/android.hardware.gnss@1.0.so.lsdump.gz

msg: Processed 2 libraries in  2.388603063424428  minutes

终于编译过了。更新了android.hardware.gnss@1.0.so.lsdump.gz文件。

以上是关于Android P VNDK报错的主要内容,如果未能解决你的问题,请参考以下文章

关于Android 供应商原生开发套件(VNDK)引发的问题

android报错

android序列化相关java.lang.ClassCastException: android studio 找不到报错的地方

「android」Ubuntu下android studio 编译报错A problem occurred starting process 'command '/Android/Sd

Android的报错提示:Failed to resolve: io.reactivex.rxjava2:rxjava:2.2.6

错误记录记录 Android 命令行执行 Java 程序中出现的错误 ( dx 打包 PC 可执行文件报错 | dalvik 命令执行 kotlin 编译的 dex 文件报错 )