I wand to implement a project with OpenCV . I have imported the the OpenCV SDK in the project and i am getting the error in as follows:-
java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
i have read your solution in stackoverflow. The link is as below:-
Android Studio CMake - shared library missing libc++_shared.so? Can CMake bundle this?
and i have tried to implement a solution from github:-
https://github.com/jomof/ndk-stl/blob/master/ndk-stl-config.cmake
I could not find any solution.
I just want "libc++_shared.so" packaged into the apk and the SDK runs properly in my project. i have no knowledge about the build tool cmake or ndk-build.
Please give a simple solution so that i can enable "libc++_shared.so" in the application so that the OpenCV project run properly.
My Error Log looks as below.
My Project structure looks as:-
Earlier i have added CMakeLists.txt as mentioned in the OpenCV SDK as
cmake_minimum_required(VERSION 3.6)
# dummy target to bring libc++_shared.so into packages
add_library(opencv_jni_shared STATIC dummy.cpp)
and a dummmy.cpp file that may include "libc++_shared.so" in the apk. Yet No results.
Please help with a solution.
Try to add the following line into your build.gradle file from the app section.
arguments "-DANDROID_STL=c++_shared"
It must be added to the externalNativeBuild sub-section.
android {
.
.
defaultConfig {
.
externalNativeBuild {
cmake {
.
arguments "-DANDROID_STL=c++_shared"
}
}
}
}
btw: Ranjit Vamadevan, I don't see your solution here but you mentioned you found one in your comments directly. I can not answer there. Could you please share it with us too?
This solved it for me: Put the content of the C:\Users%username%\AppData\Local\Android\sdk\ndk-bundle\sources\cxx-stl\llvm-libc++\libs%platform%\libc++_shared.so file in your jniLibs folder(s).
Found here: https://github.com/bkaradzic/bgfx/issues/1122#issuecomment-296356682
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With