1

Everything compiled well and my apk is built, but at runtime I get this error:

java.lang.UnsatisfiedLinkError: dlopen failed: library "../../../../libs/x86/mylib.so" not found

I tried to extract the apk and check libs/x86 folder and the .so is there.

My android field at app/build.gradle is:

android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.example.example.test"
    minSdkVersion 21
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    externalNativeBuild {
        cmake {
            cppFlags ""
        }
    }

    ndk {
        abiFilters "x86"
    }
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
sourceSets {
    main {
        jniLibs.srcDirs = ['libs']
    }
}
externalNativeBuild {
    cmake {
        path "CMakeLists.txt"
    }
}

}

WhyWhyWhy
  • 85
  • 7
  • Which device you use? you compile it to "x86" abi, maybe your problem that your device is "arm" abi. please try to change it to: abiFilters 'armeabi-v7a', 'arm64-v8a'. – y30 Nov 05 '18 at 03:38
  • Also why you use "jniLibs.srcDirs = ['libs']", which gradle version you use? please update your gradle. – y30 Nov 05 '18 at 03:47
  • Possible duplicate of [Android NDK: dlopen failed](https://stackoverflow.com/questions/47279824/android-ndk-dlopen-failed) – Dan Albert Nov 05 '18 at 20:33
  • not a duplicate, that linked question has a different error – Daniel C Jacobs Mar 08 '22 at 21:29

0 Answers0