NullPointerException on RenderScript.validate()
Hello,
I received a crash report for an android app I use BlurView with. I've only seen this once, but I thought the stack trace might be useful for future debugging. Let me know if I can be of any more assistance. The stack trace is:
Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.renderscript.RenderScript.validate()' on a null object reference at android.renderscript.BaseObj.getID(BaseObj.java:53) at android.renderscript.Script.setVar(Script.java:378) at android.renderscript.ScriptIntrinsicBlur.setRadius(ScriptIntrinsicBlur.java:80) at eightbitlab.com.blurview.RenderScriptBlur.blur(RenderScriptBlur.java:58) at eightbitlab.com.blurview.BlockingBlurController.blurAndSave(BlockingBlurController.java:240) at eightbitlab.com.blurview.BlockingBlurController.updateBlur(BlockingBlurController.java:154) at eightbitlab.com.blurview.BlockingBlurController$1.onPreDraw(BlockingBlurController.java:61) at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:977) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2631) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1565) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7612) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1034) at android.view.Choreographer.doCallbacks(Choreographer.java:845) at android.view.Choreographer.doFrame(Choreographer.java:780) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1020) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:205) at android.app.ActivityThread.main(ActivityThread.java:6892) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:860)
The only assumption I can make is that you're somehow reusing RenderScriptBlur object between multiple .setupWith calls.
This might be the cause. Can you share the overall BlurView usage flow?
Hey @Dimezis sorry for the long delay. Here is the code that sets up all the blur information.
public void setBlurredView(View viewToBlur) {
viewToBlur.setBackgroundColor(Color.TRANSPARENT);
this.setupWith((ViewGroup)viewToBlur)
.setFrameClearDrawable(getBackground())
.setBlurAlgorithm(new RenderScriptBlur(context))
.setBlurRadius(25f)
.setBlurEnabled(true)
.setBlurAutoUpdate(false)
.setHasFixedTransformationMatrix(false);
this.invalidate();
}
This method is on a custom class
public final class CustomBlurView extends BlurView
Let me know if there is anymore information I can provide. I am starting to notice more crashes with the same stack trace.
Hey @Dimezis sorry for the long delay. Here is the code that sets up all the blur information.
public void setBlurredView(View viewToBlur) { viewToBlur.setBackgroundColor(Color.TRANSPARENT); this.setupWith((ViewGroup)viewToBlur) .setFrameClearDrawable(getBackground()) .setBlurAlgorithm(new RenderScriptBlur(context)) .setBlurRadius(25f) .setBlurEnabled(true) .setBlurAutoUpdate(false) .setHasFixedTransformationMatrix(false); this.invalidate(); }This method is on a custom class
public final class CustomBlurView extends BlurViewLet me know if there is anymore information I can provide. I am starting to notice more crashes with the same stack trace.
Hi @AAAstorga, were you able to fix this crash issue, have been facing this issue for days now.
@iabhisheksahu No I have not. We are still seeing it
Closing due to inactivity and lack of steps to reproduce. Possibly related to this