Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Fatal Exception: java.lang.IllegalArgumentException #489

Closed
jineshmistry1312 opened this issue Aug 25, 2022 · 58 comments · Fixed by bobvanratingen/react-native-blur#1

Comments

@jineshmistry1312
Copy link

I am using @react-native-community/blur": "^4.2.0"

Getting below crash issue in Firebase Crashlytics.

image

Fatal Exception: java.lang.IllegalArgumentException: Software rendering doesn't support drawRenderNode
       at android.graphics.Canvas.drawRenderNode(Canvas.java:2317)
       at eightbitlab.com.blurview.RenderEffectBlur.render(RenderEffectBlur.java:2)
       at eightbitlab.com.blurview.PreDrawBlurController.draw(PreDrawBlurController.java:56)
       at eightbitlab.com.blurview.BlurView.draw(BlurView.java:2)
       at android.view.View.draw(View.java:23770)
       at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
       at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:23)
       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
       at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:3)
@RRaideRR
Copy link

RRaideRR commented Aug 25, 2022

I'm facing the same issue on Android API 32. On Android API 30 it's running fine.

jineshmistry1312 do you know if this problem occurs on Android or iOS for your users?

java.lang.IllegalArgumentException: Software rendering doesn't support drawRenderNode
at android.graphics.Canvas.drawRenderNode(Canvas.java:2317)
at eightbitlab.com.blurview.RenderEffectBlur.render(RenderEffectBlur.java:68)
at eightbitlab.com.blurview.PreDrawBlurController.draw(PreDrawBlurController.java:159)
at eightbitlab.com.blurview.BlurView.draw(BlurView.java:52)
at android.view.View.draw(View.java:22577)
at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
at android.view.View.draw(View.java:22575)
at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
at android.view.View.draw(View.java:22575)
at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
at android.view.View.draw(View.java:22575)
at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
at android.view.View.draw(View.java:22575)
at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
at android.view.View.buildDrawingCacheImpl(View.java:21970)
at android.view.View.buildDrawingCache(View.java:21836)
at android.view.View.draw(View.java:22427)
at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
at android.view.View.draw(View.java:22575)
at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
at android.view.View.draw(View.java:22575)
at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
at android.view.View.draw(View.java:22707)
at android.view.View.draw(View.java:22577)
at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
at android.view.View.draw(View.java:22575)
at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
at android.view.View.draw(View.java:22575)
at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
at android.view.View.draw(View.java:22575)
at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
at com.facebook.react.ReactRootView.dispatchDraw(ReactRootView.java:255)
at android.view.View.draw(View.java:22575)
at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
at android.view.View.draw(View.java:22575)
at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
at android.view.View.draw(View.java:22707)
at eightbitlab.com.blurview.PreDrawBlurController.updateBlur(PreDrawBlurController.java:115)
at eightbitlab.com.blurview.PreDrawBlurController$1.onPreDraw(PreDrawBlurController.java:50)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1093)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3362)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2179)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8787)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1037)
at android.view.Choreographer.doCallbacks(Choreographer.java:845)
at android.view.Choreographer.doFrame(Choreographer.java:780)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7842)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

@vpillinger-highwater
Copy link

The issues with BlurView appear to be Android specific.

@invyctus92
Copy link

android 12 Galaxy S20+ (SM-G985F)

runtimeVersions:
{
"androidApiLevel": "31",
"osBuild": "SP1A.210812.016.G985FXXUEFVG5",
"reactNative": "0.69.5",
"reactNativeJsEngine": "hermes"
}

java.lang.IllegalArgumentException: Software rendering doesn't support drawRenderNode
        at android.graphics.Canvas.drawRenderNode(Canvas.java:2317)
        at eightbitlab.com.blurview.RenderEffectBlur.render(RenderEffectBlur.java:68)
        at eightbitlab.com.blurview.PreDrawBlurController.draw(PreDrawBlurController.java:159)
        at eightbitlab.com.blurview.BlurView.draw(BlurView.java:52)
        at android.view.View.draw(View.java:23770)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
        at android.view.View.draw(View.java:23901)
        at android.view.View.draw(View.java:23770)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at android.view.View.buildDrawingCacheImpl(View.java:23158)
        at android.view.View.buildDrawingCache(View.java:23024)
        at android.view.View.draw(View.java:23620)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
        at android.view.View.draw(View.java:23901)
        at android.view.View.draw(View.java:23770)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
        at android.view.View.draw(View.java:23901)
        at android.view.View.draw(View.java:23770)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
        at android.view.View.draw(View.java:23901)
        at android.view.View.draw(View.java:23770)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
        at android.view.View.draw(View.java:23901)
        at android.view.View.draw(View.java:23770)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
        at android.view.View.draw(View.java:23901)
        at android.view.View.draw(View.java:23770)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:783)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:755)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at com.facebook.react.ReactRootView.dispatchDraw(ReactRootView.java:291)
        at android.view.View.draw(View.java:23768)
        at android.view.ViewGroup.drawChild(ViewGroup.java:5355)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5112)
        at android.view.View.draw(View.java:23901)
        at eightbitlab.com.blurview.PreDrawBlurController.updateBlur(PreDrawBlurController.java:115)
        at eightbitlab.com.blurview.PreDrawBlurController$1.onPreDraw(PreDrawBlurController.java:50)
        at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1112)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:4189)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2911)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:10458)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1108)
        at android.view.Choreographer.doCallbacks(Choreographer.java:866)
        at android.view.Choreographer.doFrame(Choreographer.java:797)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1092)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:226)
        at android.os.Looper.loop(Looper.java:313)
        at android.app.ActivityThread.main(ActivityThread.java:8669)
        at java.lang.reflect.Method.invoke(Method.java:-2)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

@HaidarZ
Copy link

HaidarZ commented Sep 6, 2022

The issue appears on Android 12 devices and emulators.
It happens when I try to capture a viewshot using the following library react-native-view-shot

@espenjanson
Copy link

+1

@erwing-bello-teamint
Copy link

+2

@beqramo
Copy link

beqramo commented Sep 13, 2022

+1

3 similar comments
@ansumanshah
Copy link

+1

@ale-mazz
Copy link

+1

@PetrVasilev
Copy link

+1

@RickoNoNo3
Copy link

RickoNoNo3 commented Sep 20, 2022

Android 12 (OPPO K9X) same issue.

It appears on the first rendering of BlurView's parent view. If I use effects or cdm lifecycles to maintain a state field called initialized, and the BlurView is rendered only when the state is set to true, it will work fine. (double initial rendering)

But obviously, that is not a permanently effectual solution, and does not consist with the current document.

@artyorsh
Copy link
Contributor

artyorsh commented Sep 20, 2022

Those who need a patch asap can try this (works for me, but use on your own risk)

Some details after research:

  • In latest updates, the package uses BlurView@2.0.2, so there is an affecting line.

  • Usage of RenderEffectBlur throws the IllegalArgumentException, because the drawRenderNode function used in the algorithm requires hardware acceleration.

  • Usage of hardwareAccelerated=true in AndroidManifest doesn't resolve the issue

tironiigor added a commit to fit52-digital/react-native-blur that referenced this issue Oct 13, 2022
@Kureev
Copy link
Owner

Kureev commented Oct 20, 2022

@Titozzz Hi m8! Wondering if you can take a look at the issue. Seems this is something happening after the latest release, I'm not sure if I have enough context to address this one 🤔

@Titozzz
Copy link
Collaborator

Titozzz commented Oct 20, 2022

@Kureev & everyone else here, I cannot reproduce this on real device / simulator running android 12. Please provide a a reproduction, I would like to address this.
In the meantime @artyorsh patch is valid, but it's basically running the less optimised non hardware-accelerated variant all the time, but at least it's not crashing...

@Kureev
Copy link
Owner

Kureev commented Oct 21, 2022

Thank you for looking into this, @Titozzz!

Can someone provide a repro case for this one, please?

@artyorsh
Copy link
Contributor

artyorsh commented Oct 21, 2022

Yeah, that's a fair point...

@Titozzz I do not remember exact case, I think it was more about a matter of random. A month ago I've spent a few hours trying to catch the reason of the exception, but no luck. We have a couple of places in the app where Blur is used, and it doesn't throw in all of them

I can make a video recording if that can be somehow helpful

@Titozzz
Copy link
Collaborator

Titozzz commented Oct 21, 2022

It will only throw in the case the canvas isn't hardware accelerated.. but when would this happen and how to detect it, I am unsure

@RnbWd
Copy link

RnbWd commented Oct 31, 2022

I just upgraded my libraries from react-native 0.66 -> 0.70, and upgraded react-native-blur to the latest version, and I'm getting this issue on android emulator API 31

@bastianspirek
Copy link

Same problem on React native 0.68.2 and react-native-blur 4.3.0.

@mk0116
Copy link

mk0116 commented Nov 9, 2022

My app crashes under a certain condition 100%. In my case, I navigated to a screen with react-navigation and the screen has a scrollview with a blur view in it. When I pop the screen while the blur view is displaying, it crashes, but if the blur view is not displaying on the screen because I scrolled down or up then it doesn't crash. I hope this helps you guys figure out what's going on.

@Titozzz
Copy link
Collaborator

Titozzz commented Nov 9, 2022

The android library author said he would try to release a new version with a fix, so we'll update when it's ready

@miguflores
Copy link

This is algo happening to me but only when I upgraded to react navigation 6:

before upgrade (working without crashes):

  "@react-navigation/bottom-tabs": "^5.10.6",
  "@react-navigation/drawer": "^5.10.6",
  "@react-navigation/native": "^5.8.6",
  "@react-navigation/stack": "^5.12.3",
  "react-native-safe-area-context": "^3.1.8",
  "react-native-screens": "^2.2.0",

after upgrade (crashes every time I open a screen with <BlurView /> component):

    "@react-navigation/bottom-tabs": "^6.3.3",
    "@react-navigation/drawer": "^6.4.4",
    "@react-navigation/native": "^6.0.12",
    "@react-navigation/stack": "^6.2.3",
    "react-native-safe-area-context": "^4.3.3",
    "react-native-screens": "^3.17.0",

@Bayramito
Copy link

BE0765F5-B546-463C-B736-D1F2A5B70E53

Same here . In my case its crashing in both android phone and simulator

@Bayramito
Copy link

This is algo happening to me but only when I upgraded to react navigation 6:

before upgrade (working without crashes):

  "@react-navigation/bottom-tabs": "^5.10.6",
  "@react-navigation/drawer": "^5.10.6",
  "@react-navigation/native": "^5.8.6",
  "@react-navigation/stack": "^5.12.3",
  "react-native-safe-area-context": "^3.1.8",
  "react-native-screens": "^2.2.0",

after upgrade (crashes every time I open a screen with <BlurView /> component):

    "@react-navigation/bottom-tabs": "^6.3.3",
    "@react-navigation/drawer": "^6.4.4",
    "@react-navigation/native": "^6.0.12",
    "@react-navigation/stack": "^6.2.3",
    "react-native-safe-area-context": "^4.3.3",
    "react-native-screens": "^3.17.0",

i am also facing the same kind of issue. For example i am going from screen A to B , then from B to C.
But if i goBack from screen C to B it crashes every single time.

@Bayramito
Copy link

Bayramito commented Nov 15, 2022

I think spotted the react-navigation related issue. So when you trying to navigate to a screen in a different navigation layer,
meaning that for examle your navigation tree looks like

Main = Stack Navigator ( with different type of NAVIGATORS in it eg. PostsNavigator, BlogsNavigator) => and you have also shared screens in this Main stack, to be able to access them from everywhere like Settings, like EditProfile....

Posts = Stack Navigator ( with post related screens in it)
If you are somewhere in PostsNavigator and If you try to navigate or dispatch (goBack/ unMount) the shared screens from the Main stack, its immediately crashing. But if you also add them to your last working screen's navigator as a screen (in example above if you add these shared screens to the PostsNavigator), then its working completely fine

@Bayramito
Copy link

My app crashes under a certain condition 100%. In my case, I navigated to a screen with react-navigation and the screen has a scrollview with a blur view in it. When I pop the screen while the blur view is displaying, it crashes, but if the blur view is not displaying on the screen because I scrolled down or up then it doesn't crash. I hope this helps you guys figure out what's going on.

#489 (comment)

@Bayramito
Copy link

It's a valid reason to disable hardware acceleration in that scenario, so this would be a better fix?

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && blurView.isHardwareAccelerated()) {
      blurView
        .setupWith(rootView, new RenderEffectBlur())
        .setFrameClearDrawable(windowBackground)
        .setBlurRadius(defaultRadius);
    } else {
      blurView
        .setupWith(rootView, new RenderScriptBlur(ctx))
        .setFrameClearDrawable(windowBackground)
        .setBlurRadius(defaultRadius);
    }

trying this right now... building...

@Bayramito
Copy link

It's a valid reason to disable hardware acceleration in that scenario, so this would be a better fix?

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && blurView.isHardwareAccelerated()) {
      blurView
        .setupWith(rootView, new RenderEffectBlur())
        .setFrameClearDrawable(windowBackground)
        .setBlurRadius(defaultRadius);
    } else {
      blurView
        .setupWith(rootView, new RenderScriptBlur(ctx))
        .setFrameClearDrawable(windowBackground)
        .setBlurRadius(defaultRadius);
    }

trying this right now... building...

It's a valid reason to disable hardware acceleration in that scenario, so this would be a better fix?

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && blurView.isHardwareAccelerated()) {
      blurView
        .setupWith(rootView, new RenderEffectBlur())
        .setFrameClearDrawable(windowBackground)
        .setBlurRadius(defaultRadius);
    } else {
      blurView
        .setupWith(rootView, new RenderScriptBlur(ctx))
        .setFrameClearDrawable(windowBackground)
        .setBlurRadius(defaultRadius);
    }

solved my issue. Thank you so much @Gregoirevda

@Bayramito
Copy link

patch file

diff --git a/node_modules/@react-native-community/blur/android/src/main/java/com/reactnativecommunity/blurview/BlurViewManagerImpl.java b/node_modules/@react-native-community/blur/android/src/main/java/com/reactnativecommunity/blurview/BlurViewManagerImpl.java
index 47030e5..32ce338 100644
--- a/node_modules/@react-native-community/blur/android/src/main/java/com/reactnativecommunity/blurview/BlurViewManagerImpl.java
+++ b/node_modules/@react-native-community/blur/android/src/main/java/com/reactnativecommunity/blurview/BlurViewManagerImpl.java
@@ -29,7 +29,7 @@ class BlurViewManagerImpl {
       .getDecorView();
     ViewGroup rootView = decorView.findViewById(android.R.id.content);
     Drawable windowBackground = decorView.getBackground();
-    if (Build.VERSION.SDK_INT >= 31) {
+if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && blurView.isHardwareAccelerated()) {
       blurView
         .setupWith(rootView, new RenderEffectBlur())
         .setFrameClearDrawable(windowBackground)

@artyorsh
Copy link
Contributor

artyorsh commented Nov 24, 2022

patch file

diff --git a/node_modules/@react-native-community/blur/android/src/main/java/com/reactnativecommunity/blurview/BlurViewManagerImpl.java b/node_modules/@react-native-community/blur/android/src/main/java/com/reactnativecommunity/blurview/BlurViewManagerImpl.java
index 47030e5..32ce338 100644
--- a/node_modules/@react-native-community/blur/android/src/main/java/com/reactnativecommunity/blurview/BlurViewManagerImpl.java
+++ b/node_modules/@react-native-community/blur/android/src/main/java/com/reactnativecommunity/blurview/BlurViewManagerImpl.java
@@ -29,7 +29,7 @@ class BlurViewManagerImpl {
       .getDecorView();
     ViewGroup rootView = decorView.findViewById(android.R.id.content);
     Drawable windowBackground = decorView.getBackground();
-    if (Build.VERSION.SDK_INT >= 31) {
+if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && blurView.isHardwareAccelerated()) {
       blurView
         .setupWith(rootView, new RenderEffectBlur())
         .setFrameClearDrawable(windowBackground)

I think then it will force most of the apps to use outdated/less performant renderer, so it doesn't differ much to what I have suggested with if statement removal. Did anyone tested which renderer is picked with adding blurView.isHardwareAccelerated() check?

@Bayramito
Copy link

Yes @artyorsh this should be a temporary fix.
Atleast app doesnt crash

@artyorsh
Copy link
Contributor

Yes @artyorsh this should be a temporary fix. Atleast app doesnt crash

yes but what is the answer, sorry

Did anyone tested which renderer is picked?

@Bayramito
Copy link

Yes @artyorsh this should be a temporary fix. Atleast app doesnt crash

yes but what is the answer, sorry

Did anyone tested which renderer is picked?

How can i check that

@Gregoirevda
Copy link

Log.d("use hardware", blurView.isHardwareAccelerated());

@Bayramito
Copy link

Log.d("use hardware", blurView.isHardwareAccelerated());

sorry for responding that late,...
i actually dunno where to put this code.
i never coded in java


if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && blurView.isHardwareAccelerated()) {
      blurView
        .setupWith(rootView, new RenderEffectBlur())
        .setFrameClearDrawable(windowBackground)
        .setBlurRadius(defaultRadius);
    } else {
      blurView
        .setupWith(rootView, new RenderScriptBlur(ctx))
        .setFrameClearDrawable(windowBackground)
        .setBlurRadius(defaultRadius);
    }
    Log.d("use hardware",new Boolean(blurView.isHardwareAccelerated()).toString());
    return blurView;
  }

used it like this. got the build now where should i check ? i dont see anything on logcat or debugger

@Gregoirevda
Copy link

You should see it in Logcat by filtering on the 1st parameter which is a tag ("use hardware")

@Bayramito
Copy link

Ekran Resmi 2022-11-24 23 09 11

this is the setup...

filtering use hardware, and dont see anything

@Gregoirevda
Copy link

Changing the Java file in your node_modules and running npm run android should work

@Bayramito
Copy link

Bayramito commented Nov 24, 2022

D/use hardware: false @Gregoirevda

@herbertvuijk
Copy link

confirming that the patch works https://github.com/Kureev/react-native-blur/pull/512/files

bobvanratingen added a commit to bobvanratingen/react-native-blur that referenced this issue Dec 6, 2022
Only use optimised if hardware acceleration isn't disabled

fixes Kureev#489
@gregoryalary
Copy link

gregoryalary commented Dec 26, 2022

Hey, do you guys have any idea of when will this patch be published on npm?

VictorioMolina added a commit to VictorioMolina/react-native-blur that referenced this issue Jan 6, 2023
@Tanmay000009
Copy link

This issue still persists with TouchableOpacity.
Doesn't throw any error with View. But when the primary component is TouchableOpacity, and has used BlurView within it, throws an exception.

@Titozzz
Copy link
Collaborator

Titozzz commented May 1, 2023

Should be fixed on latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet