Binding java library that includes a native library

I'm trying to write an app that uses my device's barcode reader.

I have an example Java app that does the job and I've changed it so that it creates an .AAR file that includes the class that I need.

I have created a Xamarin binding library and included that in my application and that binding has successfully generated a BarCodeReader class that mirrors the Java class that I am trying to use.

The problem is that it throws an exception when I call the first method in the BarCodeReader class. The logcat entry for the exception is:

07-29 09:08:17.025 9807-9807/com.xamarin.samples.taskyandroid W/System.err﹕ java.lang.UnsatisfiedLinkError: Couldn't load barcodereader44 from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.xamarin.samples.taskyandroid-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.xamarin.samples.taskyandroid-1, /vendor/lib, /system/lib]]]: findLibrary returned null

I've examined the .AAR file and it does contain this library along with others that it loads: libIAL.so, libSDL.so, libbarcodereader.so, libbarcodereader43.so and libbarcodereader44.so. At the point that the error is thrown it appears to have successfully loaded libIAL.so and libSDL.so and it fails when trying to load libbarcodereader44.so (the other two aren't loaded because they are for older versions of Android.

If I try to include any of these files into my application project with the AndroidNativeLibrary build action, I get the following error:

The "BuildApk" task failed unexpectedly. System.ArgumentException: An item with the same key has already been added.

Does anyone know why it fails to use this lib file and why it seems to be ok with IAL and SDL?

Answers

  • DerekMitchellDerekMitchell ZAMember ✭✭

    We struggled with the whole JBL thing earlier this year. I got some help on this thread:
    http://forums.xamarin.com/discussion/comment/107340/#Comment_107340
    unfortunately it is related to using the Honeywell and the jar file in their SDK.

    What device are you using?

  • SteveKayeSteveKaye GBMember

    We're not using a Honeywell device, it's a Motorola scanner component in a third party android device.

  • SergeRoy.7562SergeRoy.7562 USMember ✭✭

    I'm having the same problem, using what appears to be the library, were you able to get it work? If so what did you do? I'm stuck at the same place, but I get the error with libSDL.so instead. How did you setup the binding with the .AAR file?

Sign In or Register to comment.