JNA for Android

  • I have a huge set of C source files that, when compiled, lead to a shared library.
  • There is also a version of Java that uses JNA to access an already built shared library. These files are available in another bank. This jar is dependent on jna.

First, I compiled c files and compiled Java code. There are no errors in java. The problem only occurs when I try to port it to Android. I could easily compile c files using the android tool 'ndk-build'. This successfully creates a shared library.

I cannot import JNA into an Android project because of something like this: Android - JNA library

However, I do not understand the comments in this post. Can I use JNA in Android?

I tried to delete several files from jna.jar (files corresponding to other architectures). However, I get the same error that says: The jna.jar library contains its own libraries that will not work on the device. Including: "com / sun / jna / android-arm / libjnidispatch.so"

The box (the one that has a java wrapper for the C library) is imported and I can write the code. But I still get an "ExceptionInInitializerError" with the first object that I create using the classes in this jar.

I am not good at java. I only know a beginner. Please carry me and help. Thanks.

+4
source share
1 answer

Perhaps this is what you are looking for:

https://github.com/twall/jna/blob/master/www/AndroidDevelopmentEnvironment.md:

+3

Source: https://habr.com/ru/post/1523367/