HarmonyOS 鸿蒙Next使用napi调用第三方so崩溃
HarmonyOS 鸿蒙Next使用napi调用第三方so崩溃
我使用API10中napi调用第三方库,但是在CMakeList.txt中添加target_link_libraries以后会导致程序运行崩溃
CMakeList.txt如下:
# the minimum version of CMake.
cmake_minimum_required(VERSION 3.4.1)
project(WinmageScan)
set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
#if(DEFINED PACKAGE_FIND_FILE)
include(${PACKAGE_FIND_FILE})
#endif()
include_directories(${NATIVERENDER_ROOT_PATH}
${NATIVERENDER_ROOT_PATH}/include)
add_library(scan SHARED napi_init.cpp)
target_link_libraries(scan PUBLIC libace_napi.z.so)
target_link_libraries(scan PUBLIC ${NATIVERENDER_ROOT_PATH}/…/…/…/libs/arm64-v8a/libmy.z.so)
<button style="position: absolute; padding: 4px 8px 0px; cursor: pointer; top: 8px; right: 8px; font-size: 14px;">复制</button>
崩溃后日志信息如下:
Error message:Cannot read property add of undefined
SourceCode:
hilog.info(0x0000, ‘testTag’, ‘Test NAPI 2 + 3 = %{public}d’, testNapi.add(2, 3));
^
Stacktrace:
at anonymous (scan/src/main/ets/pages/Index.ets:16:75)
<button style="position: absolute; padding: 4px 8px 0px; cursor: pointer; top: 8px; right: 8px; font-size: 14px;">复制</button>
求助:HarmonyOS如何正确使用第三方库呢
关于HarmonyOS 鸿蒙Next使用napi调用第三方so崩溃的问题,您也可以访问:https://www.itying.com/category-93-b0.html 联系官网客服。