UnsatisfiedLinkError with monodroid and emgu - libopencv_highgui.so failed to load previously

Running a Monodroid app (Xamarin trial version) using Emgu CV (libemgucv-android-2.4.2.1773-RC) throws an UnsatisfiedLinkError when it tries to load libopencv_highgui.so, in response to the line of code below. Other Emgu calls seem to work fine.

var camera = new Capture();

  1. Running in debug or release mode (Visual Studio 2010) has the same error.
  2. My solution and APK include all the correct SO files (including libopencv_highgui.so) for the emulated CPU/ABI.
  3. I've tried various API levels, all with the same error.
  4. "adb logcat" doesn't seem to have anything different from the VS exception stack below.
    Below is the exception stack.

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).

http://stackoverflow.com/questions/15708743/unsatisfiedlinkerror-with-monodroid-and-emgu-libopencv-highgui-so-failed-to-lo

Posts

  • mtuckermtucker USMember

    It turns out I had both the 32-bit JDK & 64-bit JDK installed. Once I uninstalled the 32-bit, I got past this error. Then I started getting initcameraconnect: Unable to connect to CameraService. However I fixed that by adding the Camera permission to the Android Manifest (app properties > android manifest > create xml file > permissions).

Sign In or Register to comment.