接入微信支付宝支付SDK后,使用模拟器运行项目报错 “code:9568347 error: install parse native so failed”错误(HarmonyOS 鸿蒙Next)

接入微信支付宝支付SDK后,使用模拟器运行项目报错 “code:9568347 error: install parse native so failed”错误(HarmonyOS 鸿蒙Next) 接入微信支付宝支付SDK后使用模拟器运行项目 报错 “code:9568347 error: install parse native so failed”错误。去掉后启动项目又能正常跑了。

@casher_alipay/cashiersdk”: “^15.8.25”

@tencent/wechat_open_sdk”: “1.0.0”,

下面的配置都试过了,还是一样的报错

"buildOption": {
  "externalNativeOptions": {
    "abiFilters": [
      "arm64-v8a"
    ]
  }
}

// HarmonyOS工程

"buildOption": {
  "externalNativeOptions": {
    "abiFilters": ["arm64-v8a", "x86_64"]
  },
}

// OpenHarmony工程

"buildOption": {
  "externalNativeOptions": {
    "abiFilters": ["arm64-v8a", "x86_64", "armeabi-v7a"]
  },
}

更多关于接入微信支付宝支付SDK后,使用模拟器运行项目报错 “code:9568347 error: install parse native so failed”错误(HarmonyOS 鸿蒙Next)的实战教程也可以访问 https://www.itying.com/category-93-b0.html

3 回复

这个报错是由于工程编译出的so的abi类型和Next样机支持的abi类型不匹配导致的,工程编译出的so的类型在如下链接的abiFilters里配置

https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/build-with-ndk-ide-V5#externalnativeoptions

注:windows模拟器支持的abi是x86_64

具体排查指导如下

分析可能原因是由于设备支持的Abi类型与C++工程中配置的Abi类型不匹配导致,请通过如下步骤进行解决

  1. 执行hdc命令:
hdc shell param get const.product.cpu.abilist
  1. 若返回结果为armeabi-v7a/armeabi/arm64-v8a/x86/x86_64中的一个或多个,需要在build-profile.json5文件中"buildOption"属性下添加"abiFilters"参数中至少包含返回结果中的一个Abi类型
"externalNativeOptions": {
  "abiFilters": ["armeabi-v7a", "arm64-v8a","x86_64"]
}

返回的结果为default,则hdc shell登陆控制台后执行下面的命令

cd /system/
ls

查询是否存在lib64文件夹

  • (1)若存在lib64文件夹:则"abiFilters"参数中需要包含arm64-v8a类型
  • (2)若不存在lib64文件夹:则"abiFilters"参数中需要至少包含armeabi\armeabi-v7a中的一个类型
  1. 如果还是报错,则可能是三方依赖的so的abi导致

处理方法:1.更换x86环境所需的依赖包 2.使用真机调试

更多关于接入微信支付宝支付SDK后,使用模拟器运行项目报错 “code:9568347 error: install parse native so failed”错误(HarmonyOS 鸿蒙Next)的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


执行hdc命令返回结果是x86_64, 按上面的链接配置了CMakeLists文件,buildOption的配置也拷贝进项目配置了,还是构建失败。

CMake Generate step failed. Build files cannot be regenerated correctly。

> hvigor ERROR: Failed :entry:default@BuildNativeWithCmake...

> hvigor ERROR: Exceptions happened while executing: Not searching for unused variables given on the command line。

CMake Deprecation Warning at CMakeLists.txt:6 (cmake_minimum_required):

 Compatibility with CMake < 3.5 will be removed from a future version of

 CMake.

 Update the VERSION argument <min> value or use a ...<max> suffix to tell

 CMake that the project does not need compatibility with older versions。

-- The C compiler identification is Clang 15.0.4
-- The CXX compiler identification is Clang 15.0.4
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: F:/devEco2/DevEco Studio/sdk/default/openharmony/native/llvm/bin/clang.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: F:/devEco2/DevEco Studio/sdk/default/openharmony/native/llvm/bin/clang++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (1.0s)

CMake Error at CMakeLists.txt:17 (add_library):

 Cannot find source file:

   hello.cpp

 Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm

 .ccm .cxxm .c++m .h .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90

 .f95 .f03 .hip .ispc

CMake Error at CMakeLists.txt:17 (add_library):

 No SOURCES given to target: entry

CMake Generate step failed. Build files cannot be regenerated correctly。

> hvigor ERROR: BUILD FAILED in 2 s 935 ms

Process finished with exit code -1

在鸿蒙Next系统中,接入微信支付宝支付SDK后,使用模拟器运行项目报错“code: 9568347 error: install parse native so failed”,通常是由于模拟器无法正确解析或加载SDK中的原生库(.so文件)所致。鸿蒙Next系统对原生库的加载机制与Android不同,特别是在模拟器环境下,可能会遇到兼容性问题。建议检查以下方面:

  • SDK版本兼容性:确认使用的微信支付宝支付SDK是否支持鸿蒙Next系统,尤其是针对鸿蒙系统的适配版本。
  • 原生库支持:检查SDK中是否包含针对鸿蒙Next系统的原生库(如arm64-v8a架构的.so文件),并确保其路径和加载方式正确。
  • 模拟器环境:确认模拟器是否支持加载原生库,部分模拟器可能无法正确加载.so文件。
  • 日志分析:查看详细的日志信息,确认具体是哪个.so文件加载失败,并检查其是否符合鸿蒙Next系统的要求。
回到顶部