Error after including a 2nd JNI library to my Android project (OpenCV)

不想你离开。 提交于 2019-12-02 03:37:43

The error means that the file libuvcNative.so has not been installed with your APK. This can happen for a wild variety of root causes.

Your case is exactly same as described here. The QihanOpenSDK_1.1.8.0.aar only has an armeabi version of libuvcNative.so. The fix is to change line #15 of build.gradle to read

 abiFilters 'armeabi'

But I must confess that your CMakeLists.txt puzzled me. For me,

set_target_properties(lib_qihan PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR} /libs/QihanOpenSDK_1.1.8.0.aar)

does not work. To be sincere,

set_target_properties(lib_opencv PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR} /libs/${ANDROID_ABI}/libopencv_java3.so)

also does not match my books. For the latter, I believe that you simply added a space while copy/pasting the script.

For the former, I know a special trick to have an so file from an imported aar used in native build.

I believe that your working version not only discards all OpenCV libraries, but also does not build the libnative-lib.so. This way, cmake does never look for libuvcNative.so, but still this native lib is deployed with the APK because the aar is a compiled dependency of your app. I guess that some of the QihanOpenSDK classes explicitly calls

System.loadLibrary("uvcNative")

If your libnative-lib.so does not use external symbols from libuvcNative.so, you don't need the trick I mentioned above and don't need to mention the QihanOpenSDK at all in your CMakeLists.txt.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!