我为一个非常恼人的问题而奋斗。我有一个使用Android的OpenCV库的应用程序。问题是它引发了以下异常:
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.<clinit>(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)
我搜索了解决方案但没有任何效果。我试图手动将libopencv_java.so添加到libs / armeabi-v7a文件夹中,但每次添加它时,eclipse会自动删除它。
以下是和mk文件:
Android.mk
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)
Application.mk
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := armeabi-v7a
APP_PLATFORM := android-16
答案 0 :(得分:0)
您的项目属性下是否有'opencv library 2.4.X.jar'文件?&gt; Java构建路径 - &gt; “库”选项卡 - &gt;在Android依赖项下? 也许尝试在Project Properties&gt;下删除库。 Android&gt;库(如果你有标记),然后添加我之前提到的jar文件。