How Do I Call C/c++ Code From Android Using Jna?
Solution 1:
JNA provides a stub native library, libjnidispatch.so
for a variety of platforms. You can build this library yourself, or extract one of the pre-built binaries from the project's lib/native/<platform>.jar
packages.
You include libjnidispatch.so
in your Android project the way you would any other JNI library. This is required; you cannot rely on JNA to dynamically unpack and use its native library automatically like on other platforms. The JNA project includes details for doing so (as well as instructions for building libjnidispatch.so
yourself).
You then use jna.jar
as you would any other Java jar file, and write your own (Java) mappings to match the native library you're trying to access. There's also a jna-min.jar
which omits all the native platform libraries that are normally bundled in jna.jar
.
Solution 2:
Do go to project properties and build paths and remove JNA 4.0 and related classes. This will work!
Post a Comment for "How Do I Call C/c++ Code From Android Using Jna?"