react-native-blur icon indicating copy to clipboard operation
react-native-blur copied to clipboard

Android crash

Open elan opened this issue 4 years ago • 35 comments

We see a fair number of these show up in our bug reporting system:

java.lang.NullPointerException
Objects.java:220java.util.Objects.requireNonNull	
BlurViewManager.java:35com.cmcewen.blurview.BlurViewManager.createViewInstance	
BlurViewManager.java:20com.cmcewen.blurview.BlurViewManager.createViewInstance	
ViewManager.java:47com.facebook.react.uimanager.ViewManager.createView	
NativeViewHierarchyManager.java:256com.facebook.react.uimanager.NativeViewHierarchyManager.createView	
UIViewOperationQueue.java:200com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute	
UIViewOperationQueue.java:911com.facebook.react.uimanager.UIViewOperationQueue$1.run	
UIViewOperationQueue.java:1025com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches	
UIViewOperationQueue.java:46com.facebook.react.uimanager.UIViewOperationQueue.access$2600	
UIViewOperationQueue.java:983com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded	
GuardedRunnable.java:24com.facebook.react.bridge.GuardedRunnable.run

elan avatar Nov 13 '20 20:11 elan

Hi @elan,

Can you provide more information on the topic? For example, a repro would be quite helpful

Kureev avatar Nov 16 '20 09:11 Kureev

Unfortunately I don't have a specific one, except that I've only seen it at launch. Would seem to be a race of some kind.

elan avatar Nov 16 '20 19:11 elan

My app is also crashing in some parts or slowing down when using BlurView on Android when setting the position style to absolute.

I have a HOC for a loader when saving changes on my app, the blur is showed up on the entire screen, most of the times it works well but I have two specific pages in which the blur causes problems, either slowing down the app or crashing it

unValerio avatar Nov 24 '20 21:11 unValerio

Have anyone resolved it?

mitesh-db avatar Jan 13 '21 06:01 mitesh-db

i am facing too. It works for some seconds then crash

mohity777 avatar Jan 18 '21 20:01 mohity777

This is a pretty common issue. Apparently Android limits the number of BlurViews per activity to 1, this is a limitation of the eightbitlab.com.blurview.BlurView library.

So if you have multiple <BlurView /> views per screen, your app will crash on Android.

My advice, don't render BlurViews for Android, limit it to an iOS only feature. See the current list of Android issues

EDIT: Is this react-native library re-using the RenderScriptBlur object? See https://github.com/Dimezis/BlurView/issues/111#issuecomment-582119313

EDIT 2: Maybe the library author might be able to help if someone creates a quick (non-react-native) repro for him (see https://github.com/Dimezis/BlurView/issues/110#issuecomment-764922464)

mrousavy avatar Jan 27 '21 12:01 mrousavy

@mrousavy you are right, I am rendering a list of images in Flatlist and using BlurView for each image, and then the app is simply crashing, I think it is only supporting a single blur/screen,

hackrx avatar Jan 31 '21 12:01 hackrx

@mrousavy @Kureev Did you perhaps find a solution for this issue on Android?

bartzy avatar Feb 27 '21 09:02 bartzy

Look like a fix was made on the library: https://github.com/Dimezis/BlurView/issues/110#issuecomment-786939860

nhannah avatar Mar 04 '21 00:03 nhannah

@mrousavy you are right, I am rendering a list of images in Flatlist and using BlurView for each image, and then the app is simply crashing, I think it is only supporting a single blur/screen,

Images have a property called blurRadius that you can use. This library is needed to get Views to be blurred so maybe you dont need it .

C-odes avatar Mar 11 '21 15:03 C-odes

I've the same issue @react-native-community/blur: 3.6.0 Someone could fix it? Thanks

java.lang.NullPointerException: null
    at java.util.Objects.requireNonNull(Objects.java:203)
    at com.cmcewen.blurview.BlurViewManager.createViewInstance(BlurViewManager.java:35)
    at com.cmcewen.blurview.BlurViewManager.createViewInstance(BlurViewManager.java:20)
    at com.facebook.react.uimanager.ViewManager.createViewInstance(ViewManager.java:139)
    at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:83)
    at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:261)
    at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:186)
    at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:911)
    at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:1028)
    at com.facebook.react.uimanager.UIViewOperationQueue.access$2600(UIViewOperationQueue.java:48)
    at com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded(UIViewOperationQueue.java:986)
    at com.facebook.react.bridge.GuardedRunnable.run(GuardedRunnable.java:31)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6788)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)

RodolfoGS avatar Mar 26 '21 02:03 RodolfoGS

Fix: https://github.com/Kureev/react-native-blur/pull/411

RodolfoGS avatar Mar 30 '21 20:03 RodolfoGS

I am getting the NullPointerException as well. I'm only ever rendering one BlurView. It is positioned absolutely.

zholmes1 avatar May 21 '21 14:05 zholmes1

we also are getting this error in our project. But still exists

jellyfish-tom avatar Sep 03 '21 12:09 jellyfish-tom

it is solved by with the version 3.6.1 but not published on npm, add following to your package.json:

"@react-native-community/blur": "https://github.com/Kureev/react-native-blur/archive/refs/tags/v3.6.1.tar.gz",

enestatli avatar Sep 22 '21 10:09 enestatli

@Kureev any ideas when 3.6.1 will be published on npm? Thank you!

valeriashpiner avatar Oct 13 '21 13:10 valeriashpiner

Fix: #411

This does not fix this issue, the crash is happens when the app is in background.

This probably fixes this issue:

https://github.com/Kureev/react-native-blur/pull/399

N3TC4T avatar Oct 28 '21 11:10 N3TC4T

Any timeline for when we're going to release/publish 3.6.1 to fix this issue?

sayurimizuguchi avatar Jan 07 '22 15:01 sayurimizuguchi

We see a fair number of these show up in our bug reporting system:

java.lang.NullPointerException
Objects.java:220java.util.Objects.requireNonNull	
BlurViewManager.java:35com.cmcewen.blurview.BlurViewManager.createViewInstance	
BlurViewManager.java:20com.cmcewen.blurview.BlurViewManager.createViewInstance	
ViewManager.java:47com.facebook.react.uimanager.ViewManager.createView	
NativeViewHierarchyManager.java:256com.facebook.react.uimanager.NativeViewHierarchyManager.createView	
UIViewOperationQueue.java:200com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute	
UIViewOperationQueue.java:911com.facebook.react.uimanager.UIViewOperationQueue$1.run	
UIViewOperationQueue.java:1025com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches	
UIViewOperationQueue.java:46com.facebook.react.uimanager.UIViewOperationQueue.access$2600	
UIViewOperationQueue.java:983com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded	
GuardedRunnable.java:24com.facebook.react.bridge.GuardedRunnable.run

Facing Same Issue on Android 11

amrit220399 avatar Dec 05 '22 12:12 amrit220399

yep. Crashing on Android 11 for me too...

Fatal Exception: java.lang.NullPointerException: at java.util.Objects.requireNonNull(Objects.java:220) at com.reactnativecommunity.blurview.BlurViewManagerImpl.createViewInstance(BlurViewManagerImpl.java:27) at com.reactnativecommunity.blurview.BlurViewManager.createViewInstance(BlurViewManager.java:22) at com.reactnativecommunity.blurview.BlurViewManager.createViewInstance(BlurViewManager.java:12) at com.facebook.react.uimanager.ViewManager.createViewInstance(ViewManager.java:139) at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:83) at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:281) at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:188) at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:902) at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:1019) at com.facebook.react.uimanager.UIViewOperationQueue.access$2600(UIViewOperationQueue.java:47) at com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded(UIViewOperationQueue.java:977) at com.facebook.react.bridge.GuardedRunnable.run(GuardedRunnable.java:31) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:246) at android.app.ActivityThread.main(ActivityThread.java:8653) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

Harisene avatar Dec 24 '22 04:12 Harisene

Hi guys, this just came up on my crashlytics too. Anything close to a solution in the works?

Exception java.lang.NullPointerException: at java.util.Objects.requireNonNull (Objects.java:220) at com.reactnativecommunity.blurview.BlurViewManagerImpl.createViewInstance

praisedavid787 avatar Jan 11 '23 13:01 praisedavid787

Same I just started seeing this error after upgrading to the latest version

RnbWd avatar Mar 13 '23 04:03 RnbWd

When this will be resolved? I'm having v4.3.0 of the package. Still crashes rising up...

Harisene avatar Apr 03 '23 02:04 Harisene

Same here. v4.3.0

Juan2662 avatar Apr 26 '23 22:04 Juan2662

Same here. v4.2.0

antseburova avatar Jun 14 '23 15:06 antseburova

Same here, latest 4.3.2. Any way I can help (provide logs, other informations)?

LouisKraemer avatar Jun 15 '23 08:06 LouisKraemer

Same here. v4.3.0

dualism98 avatar Jul 18 '23 13:07 dualism98

I created a patch for v4.3.2 based on this PR and it worked like magic. We have applied the patch almost a month ago, and no issues reported since then.

Here is my patch file: @react-native-community+blur+4.3.2.patch

antseburova avatar Jul 18 '23 14:07 antseburova

Cool, thanks! 🫶🏻 Hope it works

dualism98 avatar Jul 18 '23 14:07 dualism98

I created a patch for v4.3.2 based on this PR and it worked like magic. We have applied the patch almost a month ago, and no issues reported since then.

Here is my patch file: @react-native-community+blur+4.3.2.patch

@antseburova @dualism98 Can you explain to me how I can make the patch? plz

sebas21 avatar Aug 15 '23 21:08 sebas21