简体   繁体   中英

Exception happens when using RenderScript to create a blur image

I want to create a blur image by using RenderScript but it crashes when the RenderScript rs = RenderScript.create(context); is called.

Here is the error log:

android.renderscript.RSRuntimeException: RenderScript code cache directory uninitialized

' 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)'

Does anyone have any solutions ?

Thanks

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM