问题
When using RenderScript with the support libraries I get this error on Motorola iRazr (Android 4.1.2)
Error loading RS jni library: java.lang.UnsatisfiedLinkError: Couldn't load RSSupport: findLibrary returned null
Everything works fine on Samsung Galaxy S3.
Bitmap outputBitmap = Bitmap.createBitmap(inputBitmap);
RenderScript rs = RenderScript.create(ctx);
ScriptIntrinsicBlur theIntrinsic = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
Allocation tmpIn = Allocation.createFromBitmap(rs, inputBitmap);
Allocation tmpOut = Allocation.createFromBitmap(rs, outputBitmap);
theIntrinsic.setRadius(BLUR_RADIUS);
theIntrinsic.setInput(tmpIn);
theIntrinsic.forEach(tmpOut);
tmpOut.copyTo(outputBitmap);
The support library jar I use is
build-tools/19.0.1/renderscript/lib/renderscript-v8.jar
Any help is much appreciated.
EDIT:
I copied the so files in the libs folder and verified that the so files are in the data/data/lib folder on the device.
librsjni.so and libRSSupport.so exists on the device ...
EDIT:
More detailed error:
02-26 16:17:42.311: D/dalvikvm(16985): Trying to load lib /data/data/de.proximity.hero/lib/libRSSupport.so 0x42616b70
02-26 16:17:42.321: D/dalvikvm(16985): Added shared lib /data/data/de.proximity.hero/lib/libRSSupport.so 0x42616b70
02-26 16:17:42.321: D/dalvikvm(16985): No JNI_OnLoad found in /data/data/de.proximity.hero/lib/libRSSupport.so 0x42616b70, skipping init
02-26 16:17:42.321: D/dalvikvm(16985): Trying to load lib /data/data/de.proximity.hero/lib/librsjni.so 0x42616b70
02-26 16:17:42.351: E/RenderScript_jni(16985): Error loading RS jni library: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1306]: 141 cannot locate '__strlen_chk'...
回答1:
According to Tim Murray (the guy responsible for Android renderscript support) this will be fixed in the next build tools version (probably 19.1.1).
回答2:
You don't have to use the library build-tools/19.0.1/renderscript/lib/renderscript-v8.jar
(delete it), as google team say here, you only have to include in your project.properties
file this lines:
renderscript.target=18
renderscript.support.mode=true
sdk.buildtools=19.0.3
I hope this will help you.
回答3:
I know the OP does not have this problem any more, but I just want to comment on it for anyone else who bump into this. The OP in this case probably only have the libRSSupport.so for armeabi but not x86, which is why it will work on S3 but not RAZR's "i" series devices that runs on Intel chipsets.
回答4:
As there are no solutions at the moment we decided not to use renderscript. Maybe with future updates if these problems get resolved.
回答5:
google has fixed in Build Tools, Revision 23.0.3 . You can find the support package in /build-tools/x.x.x/renderscript/lib.The problem has been resolved.
回答6:
you have to include the JNI libraries as part of your application package. Please check that you didn't accidentally strip them. You should have libRSSupport.so, librsjni.so, as well as a librs..so for each user script you have in your application. These should exist under the lib/armeabi-v7a directory for any ARM device. There should also be similar subdirectories for x86/mips.
来源:https://stackoverflow.com/questions/22040821/error-loading-rs-jni-library-unsatisfiedlinkerror-couldnt-load-rssupport-fin