Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.UnsatisfiedLinkError after changing minSdkVersion

After changing minSdkVersion from 21 to 24, i'm receiving exception:

java.lang.UnsatisfiedLinkError: dalvik.system.DexClassLoader[DexPathList[[dex file "/data/user/0/com.test.testprint/files/nepcore.dex"],nativeLibraryDirectories=[/data/app/com.test.testprint-2/lib/arm, /data/resource/lib, /vendor/lib, /system/lib]]] couldn't find "libDeviceConfig.so"

After switching back to minSdk 21, everything back to work.

I also tried to add ndk filters, was not helpful :(

Can anybody help to understand how this exception connected with minSdkVersion?

like image 645
Yevhen Avatar asked Sep 01 '25 22:09

Yevhen


2 Answers

Was needed to add one line in manifest file, inside application section :)

<application
  ...
android:extractNativeLibs="true">
like image 121
Yevhen Avatar answered Sep 03 '25 16:09

Yevhen


For minSdk >= 23 and Android Gradle Plugin >= 4.2.0, need to use useLegacyPackaging in app's build.gradle file instead of extractNativeLibs in Androidmanifest.xml

Sample usage of DSL to package compressed native libraries (can be found here)

android {
    packagingOptions {
        jniLibs {
            useLegacyPackaging true
        }
    }
}
like image 37
Samir Avatar answered Sep 03 '25 14:09

Samir