Android Studio - include and consume .so library
<p>I need to use some native libraries(.so) in my android project. According to some answers here in StackOverflow about this topic, I created a <code>jniLibs</code> folder in <code>app/src/main</code> and put there my files:</p>

<pre><code>armeabi/my_lib.so
armeabi-v7a/my_lib.so
x86/my_lib.so
</code></pre>

<p>Then, in my activity class I use:</p>

<pre><code>static {
        System.loadLibrary("my_lib");
    }
</code></pre>

<p>But when I run the app, an <code>UnsatisfiedLinkError</code> exception is generated. If this is important to be noticed, I don't have an Android.mk file, and I haven't changed anything that has to do with this in my <code>gradle</code> files. So, the only think I did is to copy-paste my <code>.so</code> files in <code>jniLibs</code> and to write the code above in my activity. So what might be the cause of this problem? Am I missing something?</p>

<p><strong>EDIT</strong></p>

<p>This is my gradle:</p>

<pre><code>apply plugin: 'com.android.application'
android {
    compileSdkVersion 15
    buildToolsVersion "23.0.3"

    compileOptions.encoding = 'ISO-8859-1'

    defaultConfig {
        applicationId "my.package"
        minSdkVersion 4
        targetSdkVersion 4

        ndk {
            moduleName "my_so_lib"
        }
    }

    sourceSets {
        main {
            jni.srcDirs = ["libs"]
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
        debug {
            debuggable true
        }
    }


    splits {
        abi {
            enable true
            reset()
            include 'x86', 'armeabi-v7a', 'mips', 'armeabi'
            universalApk false
        }
    }
}
</code></pre>