我想用的renderScript从SupportLibrary创建一个模糊EFFEKT。的Android,从SupportLibrary的renderScript和java.lang.NoClassDefFoundError
为此,我已经找到了解决办法从这里 https://stackoverflow.com/a/14988991/408780
final RenderScript rs;
rs = RenderScript.create(myAndroidContext);
final Allocation input = Allocation.createFromBitmap(rs, photo, Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT);
final Allocation output = Allocation.createTyped(rs, input.getType());
final ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
script.setRadius(myBlurRadius /* e.g. 3.f */);
script.setInput(input);
script.forEach(output);
output.copyTo(photo);
的问题是,RS = RenderScript.create(myAndroidContext)导致java.lang.NoClassDefFoundError,我不知道是什么出错了。
根据https://developer.android.com/reference/android/support/v8/renderscript/ScriptIntrinsicBlur.html ScriptIntrinsicBlur在版本中加入23.
所以我刚添加到应用程序的gradle下列行:
android {
...
defaultConfig {
...
renderscriptTargetApi 23
renderscriptSupportModeEnabled true
}
...
}
我也试图与renderscriptTargetApi 21下方 https://github.com/react-native-community/react-native-blur/issues/110#issuecomment-272956182
如所描述的但仍然没有成功。有什么建议么?
也许一些其他的相关信息:
minSdk = 14,targetSdk = 19,compileSdk = 25
预先感谢您。
对不起,对于迟到的答案。但是......还是一样,打造工具版本25.0.2,gradle这个插件版本2.1.2 – Tima