3

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'
}
user1007522
  • 7,858
  • 17
  • 69
  • 113

1 Answers1

6

Try to change this:

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

to this:

static {
    System.loadLibrary("kaliumjni");
}
bonnyz
  • 13,458
  • 5
  • 46
  • 70
  • It's not weird, by convention the 'lib' prefix is automatically added ;) – bonnyz Nov 06 '15 at 10:14
  • 1
    Hey, I'm getting the same error as op, but I have the correct loadLibrary spelling. I checked the apk, and for some reason the .so's aren't in there. One difference between our errors though is that my Android.mk is generating a libs folder, instead of a jniLibs folder. – iHowell Jun 23 '16 at 18:01