我正在尝试在 android 中实现 nanomsg,并且在此依赖
项编译 'jnanomsg:jnanomsg:0.4.3'之后,我从以下链接获得了 java 绑定: http ://niwinz.github.io/jnanomsg/。
它返回我这个 sun/jna/libjnidispatch.so 没有找到。
一段时间后,我发现 jna 所需的“.so”文件丢失了,后来我从此链接获得了所有必需的“.so”
https://github.com/java-native-access/jna/tree/master/dist之后我将 libjnidispatch.so 文件复制到 app/src/main/jniLibs/armeabi-v7a/libjnidispatch.so 和
在该应用程序编译后,我通过 System.loadLibrary("jnidispatch") 加载了 so 文件。ReqSocket sock = new ReqSocket();
当我尝试为我创建一个对象 时,出现以下错误:
java.lang.ExceptionInInitializerError
at nanomsg.Nanomsg.getSymbols(Nanomsg.java:35)
at nanomsg.Nanomsg.<clinit>(Nanomsg.java:48)
at nanomsg.Nanomsg$constants.<clinit>(Nanomsg.java:51)
at nanomsg.reqrep.ReqSocket.<init>(ReqSocket.java:13)
at com.example.nanomsg.onClick(MainActivity.java:125)
at android.view.View.performClick(View.java:5201)
at android.view.View$PerformClick.run(View.java:21163)
at android.os.Handler.handleCallback(Handler.java:746)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Caused by: java.lang.IllegalStateException: The SecurityManager implementation on this platform is broken; you must explicitly provide the class to register
at com.sun.jna.Native.getCallingClass(Native.java:1295)
at com.sun.jna.Native.register(Native.java:1252)
at nanomsg.NativeLibrary.<clinit>(NativeLibrary.java:30)
at nanomsg.Nanomsg.getSymbols(Nanomsg.java:35)
at nanomsg.Nanomsg.<clinit>(Nanomsg.java:48)
at nanomsg.Nanomsg$constants.<clinit>(Nanomsg.java:51)
at nanomsg.reqrep.ReqSocket.<init>(ReqSocket.java:13)
at com.example.nanomsg.MainActivity.onClick(MainActivity.java:125)
at android.view.View.performClick(View.java:5201)
at android.view.View$PerformClick.run(View.java:21163)
at android.os.Handler.handleCallback(Handler.java:746)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
在 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
谁能帮我在这里做错了什么。任何帮助,将不胜感激。