Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android-arm/libjnidispatch.so not found error

In my app, I am adding third party hardware connectivity and using their provided code for java. Also using jna.jar to interact with that code as it uses native library to load some .so files. It throws the error:

 java.lang.UnsatisfiedLinkError: Native library (com/sun/jna/android-arm/libjnidispatch.so) not found in resource path (.) Please help where can I get the jar with android-arm/libjnidispatch.so in it.`

I tried adding android-arm.jar which is having libjnidispatch.so separately but compiler is looking for jna.jar's path. Thanks!

like image 742
hashlover Avatar asked Dec 13 '17 18:12

hashlover


1 Answers

  1. Extract the com/sun/jna/linux-arm/libjnidispatch.so from the jar file
  2. put the .so file in the following directory (when using android studio): yourproject\app\src\main\jniLibs\armeabi-v7a\libjnidispatch.so

And also please note that linux architecture != android architecture (google uses a different c library (bionic), which is a different one than the normal linux distributions) For all architectures see:

https://github.com/java-native-access/jna/tree/master/lib/native

Which version of JNA do you use? (There was a bug in JNA 4.2.2/4.3.0 which might also be a cause)

like image 188
Lonzak Avatar answered Sep 27 '22 18:09

Lonzak