Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UnsatisfiedLinkError when adding .so files to android studio

I'm trying to include https://github.com/GerardSoleCa/Robosodium in my android studio project. I'm running Android studio 1.4.1

I created a jniLibs folder with the compiled .so files. I initializsed the library in my main activity like this:

static {
    System.loadLibrary("libkaliumjni");
}

when I run the project I get this:

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/be.example.libtest-1/base.apk"],nativeLibraryDirectories=[/data/app/be.example.libtest-1/lib/x86, /vendor/lib, /system/lib]]] couldn't find "liblibkaliumjni.so"

My folder structure is:

enter image description here

Can someone help me with this?

EDIT:

This is my build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "be.example.libtest"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.0'
    compile 'com.android.support:design:23.1.0'
}
like image 799
user1007522 Avatar asked Jul 28 '26 07:07

user1007522


1 Answers

Try to change this:

static {
    System.loadLibrary("libkaliumjni");
}

to this:

static {
    System.loadLibrary("kaliumjni");
}
like image 181
bonnyz Avatar answered Jul 30 '26 23:07

bonnyz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!