使用Emgu CV (libemgucv-android-2.4.2.1773-RC)运行 Monodroid 应用程序(Xamarin 试用版)UnsatisfiedLinkError
在尝试加载libopencv_highgui.so时会抛出错误,以响应下面的代码行。其他 Emgu 调用似乎工作正常。
var camera = new Capture();
- 在调试或发布模式下运行 (Visual Studio 2010) 有相同的错误。
- 我的解决方案和 APK 包含用于模拟 CPU/ABI 的所有正确 SO 文件(包括 libopencv_highgui.so)。
- 我尝试了各种 API 级别,都出现相同的错误。
- “adb logcat”似乎与下面的 VS 异常堆栈没有什么不同。
下面是异常堆栈。
D/dalvikvm( 1228): Trying to load lib /data/app-lib/EyeReaderApp.EyeReaderApp-1/libopencv_highgui.so 0x40ce22a0
E/dalvikvm( 1228): dlopen("/data/app-lib/EyeReaderApp.EyeReaderApp-1/libopencv_highgui.so") failed: Cannot load library: find_library(linker.cpp:889): "/data/app-lib/EyeReaderApp.EyeReaderApp-1/libopencv_highgui.so" failed to load previously
Unhandled Exception:
Java.Lang.UnsatisfiedLinkError:
Unhandled Exception:
System.TypeInitializationException:
I/MonoDroid( 1228): UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for Emgu.CV.CvInvoke ---> Java.Lang.UnsatisfiedLinkError: Exception of type 'Java.Lang.UnsatisfiedLinkError' was thrown.
I/MonoDroid( 1228): at Android.Runtime.JNIEnv.CallStaticVoidMethod (IntPtr jclass, IntPtr jmethod, Android.Runtime.JValue[] parms) [0x00023] in /Users/builder/data/lanes/monodroid-lion-bigsplash/0e0e51f9/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:973
I/MonoDroid( 1228): at Java.Lang.JavaSystem.LoadLibrary (System.String libName) [0x00034] in /Users/builder/data/lanes/monodroid-lion-bigsplash/0e0e51f9/source/monodroid/src/Mono.Android/platforms/android-14/src/generated/Java.Lang.JavaSystem.cs:259
I/MonoDroid( 1228): at Emgu.CV.CvInvoke..cctor () [0x00158] in E:\Visual Studio 2010\Projects\EyeReader\Android\libemgucv-android-2.4.2.1773-RC\Emgu.CV\PInvoke\CvInvokeCore.cs:154
I/MonoDroid( 1228): --- End of managed exception stack trace ---
I/MonoDroid( 1228): java.lang.UnsatisfiedLinkError: Cannot load library: find_library(linker.cpp:889): "/data/app-lib/EyeReaderApp.EyeReaderApp-1/libopencv_highgui.so" failed to load previously
I/MonoDroid( 1228): at java.lang.Runtime.loadLibrary(Runtime.java:371)
I/MonoDroid( 1228): at java.lang.System.loadLibrary(System.java:535)
I/MonoDroid( 1228): at mono.android.view.View_OnClickListenerImplementor.n_onClick(Native Method)
I/MonoDroid( 1228): at mono.android.view.View_OnClickListenerImplementor.onClick(View_OnClickListenerImplementor.java:29)
I/MonoDroid( 1228): at android.view.View.performClick(View.java:4204)
I/MonoDroid( 1228): at android.view.View$PerformClick.run(View.java:17355)
I/MonoDroid( 1228): at android.os.Handler.handleCallback(Handler.java:725)
I/MonoDroid( 1228): at android.os.Handler.dispatchMessage(Handler.java:92)
I/MonoDroid( 1228): at android.os.Looper.loop(Looper.java:137)
I/MonoDroid( 1228): at android.app.ActivityThread.main(ActivityThread.java:5041)
I/MonoDroid( 1228): at java.lang.reflect.Method.invokeNative(Native Method)
I/MonoDroid( 1228): at java.lang.reflect.Method.invoke(Method.java:511)
I/MonoDroid( 1228): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
I/MonoDroid( 1228): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
I/MonoDroid( 1228): at dalvik.system.NativeStart.main(Native Method)
I/MonoDroid( 1228):
I/MonoDroid( 1228): --- End of inner exception stack trace ---
I/MonoDroid( 1228): at Emgu.CV.Capture..ctor (int) [0x0001d] in E:\Visual Studio 2010\Projects\EyeReader\Android\libemgucv-android-2.4.2.1773-RC\Emgu.CV\Capture\Capture.cs:162
I/MonoDroid( 1228): at Emgu.CV.Capture..ctor () [0x00000] in E:\Visual Studio 2010\Projects\EyeReader\Android\libemgucv-android-2.4.2.1773-RC\Emgu.CV\Capture\Capture.cs:149
I/MonoDroid( 1228): at EyeReaderApp.MainScreen.StartCamera () [0x00010] in E:\Visual Studio 2010\Projects\EyeReader\Android\EyeReaderApp\Screens\MainScreen.cs:78
I/MonoDroid( 1228): at EyeReaderApp.MainScreen.CameraButton_Click (object,System.EventArgs) [0x00017] in E:\Visual Studio 2010\Projects\EyeReader\Android\EyeReaderApp\Screens\MainScreen.cs:62
I/MonoDroid( 1228): at Android.Views.View/IOnClickListenerImplementor.OnClick (Android.Views.View) [0x0000b] in /Users/builder/data/lanes/monodroid-lion-bigsplash/0e0e51f9/source/monodroid/src/Mono.Android/platforms/android-14/src/generated/Android.Views.View.cs:1267
I/MonoDroid( 1228): at Android.Views.View/IOnClickListenerInvoker.n_OnClick_Landroid_view_View_ (intptr,intptr,intptr) [0x00010] in /Users/builder/data/lanes/monodroid-lion-bigsplash/0e0e51f9/source/monodroid/src/Mono.Android/platforms/android-14/src/generated/Android.Views.View.cs:1238
I/MonoDroid( 1228): at (wrapper dynamic-method) object.7be55d07-8ea3-4414-a38c-584f4ca07a4b (intptr,intptr,intptr) <IL 0x00017, 0x00043>
Unhandled Exception:
System.TypeInitializationException:
E/mono ( 1228):
E/mono ( 1228): Unhandled Exception:
E/mono ( 1228): System.TypeInitializationException: An exception was thrown by the type initializer for Emgu.CV.CvInvoke ---> Java.Lang.UnsatisfiedLinkError: Exception of type 'Java.Lang.UnsatisfiedLinkError' was thrown.
E/mono ( 1228): at Android.Runtime.JNIEnv.CallStaticVoidMethod (IntPtr jclass, IntPtr jmethod, Android.Runtime.JValue[] parms) [0x00023] in /Users/builder/data/lanes/monodroid-lion-bigsplash/0e0e51f9/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:973
E/mono ( 1228): at Java.Lang.JavaSystem.LoadLibrary (System.String libName) [0x00034] in /Users/builder/data/lanes/monodroid-lion-bigsplash/0e0e51f9/source/monodroid/src/Mono.Android/platforms/android-14/src/generated/Java.Lang.JavaSystem.cs:259
E/mono ( 1228): at Emgu.CV.CvInvoke..cctor () [0x00158] in E:\Visual Studio 2010\Projects\EyeReader\Android\libemgucv-android-2.4.2.1773-RC\Emgu.CV\PInvoke\CvInvokeCore.cs:154
E/mono ( 1228): --- End of managed exception stack trace ---
E/mono ( 1228): java.lang.UnsatisfiedLinkError: Cannot load library: find_library(linker.cpp:889): "/data/app-lib/EyeRea
I/mono ( 1228): [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for Emgu.CV.CvInvoke ---> Java.Lang.UnsatisfiedLinkError: Exception of type 'Java.Lang.UnsatisfiedLinkError' was thrown.
I/mono ( 1228): at Android.Runtime.JNIEnv.CallStaticVoidMethod (IntPtr jclass, IntPtr jmethod, Android.Runtime.JValue[] parms) [0x00023] in /Users/builder/data/lanes/monodroid-lion-bigsplash/0e0e51f9/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:973
The program 'Mono' has exited with code 255 (0xff).