title: Android studio: UnsatisfiedLinkError: findLibrary returned null - loading native library
body: <p>I am making an app in Android Studio which uses two libraries. A native library with an Android wrapper and a jar-library.
  For some reason, the native library won't load if the other jar-library is compiled into the project. So if I run the app with only the native library, everything works fine. I add the other jar-library to my gradle-file and boom... an UnsatisfiedLinkError:</p>
  
  <pre><code>java.lang.UnsatisfiedLinkError: Couldn't load MobileOcrEngine from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.app-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.app-1, /vendor/lib, /system/lib]]]: findLibrary returned null
  </code></pre>
  
  <p>My app runs fine when I use this:</p>
  
  <pre><code>dependencies {
      compile fileTree(include: ['*.jar'], dir: 'src/main/jniLibs')
      compile 'com.android.support:support-v13:21.0.2'
      compile project(':wheel')
  }
  </code></pre>
  
  <p>The error occurs when I try:</p>
  
  <pre><code>dependencies {
      compile fileTree(include: ['*.jar'], dir: 'src/main/jniLibs')
      compile 'com.android.support:support-v13:21.0.2'
      compile project(':wheel')
      compile files('libs/realm-0.78.0.jar')
  }
  </code></pre>
  
  <p>or when I try to use the same library but using the Maven repository:</p>
  
  <pre><code>dependencies {
      compile fileTree(include: ['*.jar'], dir: 'src/main/jniLibs')
      compile 'com.android.support:support-v13:21.0.2'
      compile project(':wheel')
      compile 'io.realm:realm-android:0.78.0'
  }
  </code></pre>
  
  <p>or if I try to place the jar in jniLibs folder:</p>
  
  <pre><code>dependencies {
      compile fileTree(include: ['*.jar'], dir: 'src/main/jniLibs')
      compile 'com.android.support:support-v13:21.0.2'
      compile project(':wheel')
  }
  </code></pre>
  
  <p>I have no idea where the root of the problem lies. With one of the two libraries, Android Studio or am I doing something wrong?</p>
  
  <p><strong>Note:</strong>
  I know there have been many questions on StackOverflow regarding UnsatisfiedLinkErrors, yet none of these provide solutions for my problem. I have no problem loading the native library if it's the only library I use...</p>