问题
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