Android - JNA library

拥有回忆 提交于 2019-12-22 10:47:04

问题


Hello i'm using JNA to be able to use an external .dll(i don't have the header file but i have documentation thus the exposed function signatures).

I have managed to use my dll in a java project following the instructions here and now i'm trying to use the same thing on an android app.

I imporetd the jna jar in my libs and also added the jar in my buildpath and i'm getting an error

The library 'jna-3.5.1.jar' contains native libraries that will not run on the device.
The following libraries were found:
com/sun/jna/linux-amd64/libjnidispatch.so
com/sun/jna/darwin/libjnidispatch.jnilib
com/sun/jna/linux-i386/libjnidispatch.so
com/sun/jna/sunos-x86/libjnidispatch.so
com/sun/jna/sunos-amd64/libjnidispatch.so
com/sun/jna/sunos-sparc/libjnidispatch.so
com/sun/jna/sunos-sparcv9/libjnidispatch.so

Any ideas?


回答1:


This deserves an answer...

Did you compile the lib you wanna use for android?

Why not write a JNI wrapper around those native libs, and invoke that from your android app?




回答2:


Browse your jna.jar and delete the files displayed on your message :

com/sun/jna/linux-amd64/libjnidispatch.so
com/sun/jna/darwin/libjnidispatch.jnilib
com/sun/jna/linux-i386/libjnidispatch.so
com/sun/jna/sunos-x86/libjnidispatch.so
com/sun/jna/sunos-amd64/libjnidispatch.so
com/sun/jna/sunos-sparc/libjnidispatch.so
com/sun/jna/sunos-sparcv9/libjnidispatch.so

Then maybe you need to restart your IDE and that should work.



来源:https://stackoverflow.com/questions/15765212/android-jna-library

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!