I'm struggling to include a prebuilt shared library in my android project
The library in question is libusb, which the NDK part of my android project requires.
Everything is compiling and linking OK, i.e. the project is building successfully, but on installing the apk on my device the app is crashing.
The relevant error msg from monitor is:
java.lang.UnsatisfiedLinkError: dlopen failed: library "libusb1.0.so" not found
what i've tried so far is adding the following to my app/build.gradle:
sourceSets{
main {
// let gradle pack the shared library into apk
jniLibs.srcDirs = '/home/me/third-party/libusb-1.0.21/android/libs/'
}
in CMakeLists.txt i've added:
set(libusb_DIR $ENV{HOME}/third-party/libusb-1.0.21/android/libs)
set(libusb_LIB usb1.0)
link_directories( ${libusb_DIR}/${ANDROID_ABI}/ )
target_link_libraries( ${libusb_LIB} )
I've even tried creating a app/src/main/jniLibs
dir and manually copying the armeabi-v7a version of the shared lib, libusb1.0.so
, in there.
Still getting same error message in Monitor after the apk has been installed..