title: Android NDK - Library not found
body: <p>I work with Android Studio and Android NDK.
  My folder "src/main/jni" contains the following files:</p>
  
  <ul>
  <li>Android.mk </li>
  <li>Application.mk </li>
  <li>HelloWorld.cpp</li>
  </ul>
  
  <p>Application.mk
  <code>APP_ABI := all</code></p>
  
  <p>Android.mk</p>
  
  <pre><code>LOCAL_PATH := $(call my-dir)
  include $(CLEAR_VARS)
  LOCAL_MODULE := HelloWorld
  LOCAL_SRC_FILES := HelloWorld.cpp
  include $(BUILD_SHARED_LIBRARY)
  </code></pre>
  
  <p>In my Java code, I load the library:</p>
  
  <pre><code>static{
      System.load("HelloWorld");
  }
  </code></pre>
  
  <p>I run ndk-build as below and it runs without error: <code>ndk-build -C src/main</code></p>
  
  <p>build.gradle contains:</p>
  
  <pre><code>sourceSets.main {
  jniLibs.srcDirs 'src/main/libs'
  jni.srcDirs = [] //disable automatic ndk-build call
  }
  </code></pre>
  
  <p>libHelloWorld.so is compiled and copied to the folders:<code>app\src\main\libs\arm*\</code></p>
  
  <p>The root directory of app-debug.apk contains a lib directory. 
  libHelloWorld.so exists in all subdirectories (lib\arm*)</p>
  
  <p>When I deploy and debug the application on the LG Nexus 4 device, I get the following error:</p>
  
  <pre><code>9-24 18:50:51.486  20352-20352/ndk.tests.firstndk E/art﹕ dlopen("HelloWorld", RTLD_LAZY) failed: dlopen failed: library "HelloWorld" not found
  09-24 18:50:51.489  20352-20352/ndk.tests.firstndk D/AndroidRuntime﹕ Shutting down VM
  09-24 18:50:51.491  20352-20352/ndk.tests.firstndk E/AndroidRuntime﹕ FATAL EXCEPTION: main
  Process: ndk.tests.firstndk, PID: 20352
  java.lang.UnsatisfiedLinkError: dlopen failed: library "HelloWorld" not found
  at java.lang.Runtime.load(Runtime.java:331)
  at java.lang.System.load(System.java:981)
  at ndk.tests.firstndk.MainActivity.&lt;clinit&gt;(MainActivity.java:11)
  at java.lang.reflect.Constructor.newInstance(Native Method)
  </code></pre>
  
  <p>Could you please help to solve this issue? Why my native lib cannot be loaded? What is wrong with my configuration?</p>