how to load libandroid_runtime

房东的猫 提交于 2020-01-13 04:52:30

问题


I'm working on a project that gets compiled into a JAR and then deployed using javaws. In one of my classes, I need to load the libandroid_runtime.so found in directory /system/lib/ on the device.

How do I do this?

System.load("libandroid_runtime")throws java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: libandroid_runtime

System.loadLibrary("/system/lib/libandroid_runtime.so") throws java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: /system/lib/libandroid_runtime.so.

System.loadLibrary("android_runtime"); throws java.lang.UnsatisfiedLinkError: no android_runtime in java.library.path

thanks!


回答1:


I'm working on a project that gets compiled into a JAR and then deployed using javaws

Android does not use Java Web Start.

In one of my classes, I need to load the libandroid_runtime.so found in directory /system/lib/ on the device.

That is not possible. You do not have read access to /system.




回答2:


System.loadLibrary("android_runtime"); requires the library libandroid_runtime.so to be in /data/data/{app}/lib while System.load("/system/lib/libandroid_runtime.so"); requires the full path.

So none of your calls is correct. The answer is System.load("/system/lib/libandroid_runtime.so");



来源:https://stackoverflow.com/questions/9220984/how-to-load-libandroid-runtime

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