title: Manually (aapt) add native library .so to apk
body: <p>For multiple reasons I'm building my project manually (more or less following these steps <a href="http://geosoft.no/development/android.html" rel="nofollow">http://geosoft.no/development/android.html</a>), whithout using ant.</p>
  
  <p>My projects uses the NDK and builds a <code>.so</code> library.</p>
  
  <ul>
  <li>With Eclipse:</li>
  </ul>
  
  <p>When I use Eclipse to build my project, everything works: I drag&amp;drop <code>libMyNativeLib.so</code> in the <code>libs/armeabi</code> directory and when I call <code>loadLibrary(MyNativeLib)</code> it works fine: I can call native method from my Java code.</p>
  
  <ul>
  <li>Manually:</li>
  </ul>
  
  <p>Now I want to build manually my <code>.apk</code>. Everything works except from the native lib loading.
  Using <code>aapt add</code>, I have added in my apk : <code>lib/armeabi/libMyNativeLib.so</code> (I saw that the apk generated by Eclipse contains this .so in <code>lib/armeabi</code> so I used the same path in the apk).
  When calling <code>loadLibrary(MyNativeLib)</code>, I got the following exception </p>
  
  <pre><code>java.lang.UnsatisfiedLinkError: Couldn't load MyNativeLib from loader dalvik.system.PathClassLoader[DexPathList...
  </code></pre>
  
  <p>Why is that ?</p>
  
  <p>Should I do something in the <code>dx --dex</code> step regarding the native code (<code>.so</code> lib) ? I don't think so but I'm maybe wrong ? (I'm only using <code>dx --dex</code> with my <code>.jar</code> libs which is logic I guess).</p>
  
  <p>Do you have any idea ?</p>
  
  <p>Thanks</p>