title: UnsitisfiedLinkError: Couldn't load libopencv_java.so
body: <p>I struggle with a very annoying problem. I have an app which uses the OpenCV library for Android. The problem is that it throws me the following exception:</p>
  
  <pre><code>12-07 14:19:27.420: E/AndroidRuntime(19108): FATAL EXCEPTION: main
  12-07 14:19:27.420: E/AndroidRuntime(19108): java.lang.UnsatisfiedLinkError: Couldn't load libopencv_java.so from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.elsys.coursework.smartcam-2.apk"],nativeLibraryDirectories=[/data/app-lib/org.elsys.coursework.smartcam-2, /vendor/lib, /system/lib]]]: findLibrary returned null
  12-07 14:19:27.420: E/AndroidRuntime(19108):    at java.lang.Runtime.loadLibrary(Runtime.java:355)
  12-07 14:19:27.420: E/AndroidRuntime(19108):    at java.lang.System.loadLibrary(System.java:525)
  12-07 14:19:27.420: E/AndroidRuntime(19108):    at org.elsys.coursework.smartcam.MainActivity.&lt;clinit&gt;(MainActivity.java:110)
  12-07 14:19:27.420: E/AndroidRuntime(19108):    at java.lang.Class.newInstanceImpl(Native Method)
  12-07 14:19:27.420: E/AndroidRuntime(19108):    at java.lang.Class.newInstance(Class.java:1130)
  12-07 14:19:27.420: E/AndroidRuntime(19108):    at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
  12-07 14:19:27.420: E/AndroidRuntime(19108):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2178)
  12-07 14:19:27.420: E/AndroidRuntime(19108):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2311)
  12-07 14:19:27.420: E/AndroidRuntime(19108):    at android.app.ActivityThread.access$600(ActivityThread.java:149)
  12-07 14:19:27.420: E/AndroidRuntime(19108):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293)
  12-07 14:19:27.420: E/AndroidRuntime(19108):    at android.os.Handler.dispatchMessage(Handler.java:99)
  12-07 14:19:27.420: E/AndroidRuntime(19108):    at android.os.Looper.loop(Looper.java:137)
  12-07 14:19:27.420: E/AndroidRuntime(19108):    at android.app.ActivityThread.main(ActivityThread.java:5214)
  12-07 14:19:27.420: E/AndroidRuntime(19108):    at java.lang.reflect.Method.invokeNative(Native Method)
  12-07 14:19:27.420: E/AndroidRuntime(19108):    at java.lang.reflect.Method.invoke(Method.java:525)
  12-07 14:19:27.420: E/AndroidRuntime(19108):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
  12-07 14:19:27.420: E/AndroidRuntime(19108):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
  12-07 14:19:27.420: E/AndroidRuntime(19108):    at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>I searched for solutions but nothing worked. I tried to add libopencv_java.so to the libs/armeabi-v7a folder manually but every time I add it, the eclipse deletes it automatically by itself. </p>
  
  <p>Here are and the mk files:</p>
  
  <p><strong>Android.mk</strong></p>
  
  <pre><code>    LOCAL_PATH := $(call my-dir)
  
      include $(CLEAR_VARS)
  
      include  /home/crash-id/Development/SDK/OpenCV-2.4.9-android-sdk/sdk/native/jni/OpenCV.mk
  
      LOCAL_MODULE := orbdetector
      LOCAL_SRC_FILES := ORBDetector.cpp
      LOCAL_LDLIBS +=  -llog -ldl
  
  
  include $(BUILD_SHARED_LIBRARY)
  </code></pre>
  
  <p><strong>Application.mk</strong></p>
  
  <pre><code>APP_STL := gnustl_static
  APP_CPPFLAGS := -frtti -fexceptions
  APP_ABI := armeabi-v7a
  APP_PLATFORM := android-16
  </code></pre>