how to load libandroid_runtime

2020-07-23 05:58发布

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!

2条回答
够拽才男人
2楼-- · 2020-07-23 06:27

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.

查看更多
地球回转人心会变
3楼-- · 2020-07-23 06:37

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");

查看更多
登录 后发表回答