title: java.lang.UnsatisfiedLinkError when loading native library in Android 5.0
body: <p>I am loading my native library by:</p>
  
  <pre><code>try {
         System.loadLibrary("myNative");
  } catch (UnsatisfiedLinkError e) {
         //java.lang.UnsatisfiedLinkError here
         System.load("/data/data/com.my.app/app_native/libmyNative.so");
  }
  </code></pre>
  
  <p>The above code is finally packaged to a Jar file. </p>
  
  <p>In another project, I load the above Jar with <a href="http://developer.android.com/reference/dalvik/system/DexClassLoader.html" rel="nofollow">DexClassLoader</a>:</p>
  
  <pre><code>DexClassLoader dexClassLoader = new DexClassLoader(jarPath,
                      optJarPath,
                      getDir("native", Context.MODE_PRIVATE),
                      getClassLoader());
  </code></pre>
  
  <p>Notice that when constructing this <code>dexClassLoader</code> instance, I have specified the <strong>path</strong> where the native code is located, that's <code>getDir("native", Context.MODE_PRIVATE)</code>.</p>
  
  <p>(I am using <a href="https://developer.android.com/tools/sdk/ndk/index.html" rel="nofollow">NDK release 10</a> to generate the native library. When the native code file <strong>libmyNative.so</strong> is generated, my java code (which packaged to final Jar) checks the CPU architecture type &amp; copy the right one to <code>getDir("native", Context.MODE_PRIVATE)</code>.)</p>
  
  <p>The above code works fine on other devices except Android 5.0 Lollipop. When run on <strong>Android 5.0 Lollipop</strong> device, I constantly get the following error:</p>
  
  <pre><code>java.lang.UnsatisfiedLinkError: dlopen failed: "/data/data/com.my.app/app_native/libmyNative.so" is 32-bit instead of 64-bit
  at java.lang.Runtime.load(Runtime.java:331)
  at java.lang.System.load(System.java:982)
  </code></pre>
  
  <p>How to solve this problem?</p>