使用RenderScript创建模糊图像时发生异常

时间:2018-01-16 09:10:26

标签: android renderscript

我想使用RenderScript创建模糊图像,但在调用RenderScript rs = RenderScript.create(context);时崩溃。

以下是错误日志:

android.renderscript.RSRuntimeException:未初始化的RenderScript代码缓存目录

' android.renderscript.RSRuntimeException: RenderScript code cache directory uninitialized.
01-16 16:28:54.667 25502 25502 E AndroidRuntime:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
01-16 16:28:54.667 25502 25502 E AndroidRuntime:    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
01-16 16:28:54.667 25502 25502 E AndroidRuntime:    at android.app.ActivityThread.-wrap12(ActivityThread.java)
01-16 16:28:54.667 25502 25502 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
01-16 16:28:54.667 25502 25502 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:102)
01-16 16:28:54.667 25502 25502 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:154)
01-16 16:28:54.667 25502 25502 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:6097)
01-16 16:28:54.667 25502 25502 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
01-16 16:28:54.667 25502 25502 E AndroidRuntime:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:925)
01-16 16:28:54.667 25502 25502 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:813)
01-16 16:28:54.667 25502 25502 E AndroidRuntime: Caused by: android.renderscript.RSRuntimeException: RenderScript code cache directory uninitialized.
01-16 16:28:54.667 25502 25502 E AndroidRuntime:    at android.renderscript.RenderScript.getCachePath(RenderScript.java:1392)
01-16 16:28:54.667 25502 25502 E AndroidRuntime:    at android.renderscript.RenderScript.internalCreate(RenderScript.java:1430)
01-16 16:28:54.667 25502 25502 E AndroidRuntime:    at android.renderscript.RenderScript.create(RenderScript.java:1526)
01-16 16:28:54.667 25502 25502 E AndroidRuntime:    at android.renderscript.RenderScript.create(RenderScript.java:1485)
01-16 16:28:54.667 25502 25502 E AndroidRuntime:    at android.renderscript.RenderScript.create(RenderScript.java:1459)
01-16 16:28:54.667 25502 25502 E AndroidRuntime:    at android.renderscript.RenderScript.create(RenderScript.java:1446)'

有没有人有任何解决方案?

由于

1 个答案:

答案 0 :(得分:1)

我建议你使用android support v8 renderscipt库来避免一些系统问题。