2013-03-29 91 views
0

運行MonoDroid的應用程序中使用Emgu CV(libemgucv-Android的2.4.2.1773-RC)拋出UnsatisfiedLinkError時,它會嘗試加載(Xamarin試用版) libopencv_highgui.so,以響應下面的代碼行。其他Emgu調用似乎工作正常。UnsatisfiedLinkError與MonoDroid的和emgu - libopencv_highgui.so加載失敗以前

var camera = new Capture(); 
  1. 在調試或發行模式(Visual Studio 2010中)運行具有相同的錯誤。
  2. 我的解決方案和APK包含模擬CPU/ABI的所有正確SO文件(包括libopencv_highgui.so)。
  3. 我已經嘗試過各種API級別,都有相同的錯誤。
  4. 「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). 

回答

0

事實證明,我已經安裝了32位JDK & 64位JDK。一旦我卸載了32位,我得到了這個錯誤。然後我開始獲得initcameraconnect: Unable to connect to CameraService。不過,我通過將相機權限添加到Android Manifest(應用程序屬性> android清單>創建xml文件>權限)來解決此問題。