Kureev / react-native-blur

React Native Blur component
MIT License
3.75k stars 556 forks source link

Android crash #405

Open elan opened 3 years ago

elan commented 3 years ago

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
Kureev commented 3 years ago

Hi @elan,

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

elan commented 3 years ago

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.

unValerio commented 3 years ago

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

mitesh-db commented 3 years ago

Have anyone resolved it?

mohity777 commented 3 years ago

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

mrousavy commented 3 years ago

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)

hackrx commented 3 years ago

@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,

bartzy commented 3 years ago

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

nhannah commented 3 years ago

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

C-odes commented 3 years ago

@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 .

RodolfoGS commented 3 years ago

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 commented 3 years ago

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

zholmes1 commented 3 years ago

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

jellyfish-tom commented 3 years ago

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

enestatli commented 2 years ago

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",

valeriashpiner commented 2 years ago

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

N3TC4T commented 2 years ago

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

sayurimizuguchi commented 2 years ago

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

amrit220399 commented 1 year ago

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

Harisene commented 1 year ago

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)

praisedavid787 commented 1 year ago

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

RnbWd commented 1 year ago

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

Harisene commented 1 year ago

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

Juan2662 commented 1 year ago

Same here. v4.3.0

antseburova commented 1 year ago

Same here. v4.2.0

LouisKraemer commented 1 year ago

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

dualism98 commented 1 year ago

Same here. v4.3.0

antseburova commented 1 year ago

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

dualism98 commented 1 year ago

Cool, thanks! 🫶🏻 Hope it works

sebas21 commented 1 year ago

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

dualism98 commented 1 year ago

Hey, @sebas21. You need use this package for patches - https://www.npmjs.com/package/patch-package

dualism98 commented 1 year ago

@sebas21. It looks like he doesn't delete the methods, but changes the create View Instance method, adding a null check so that there is no crash

elgambet commented 4 months ago

Still having this problem, it only happens on prod for some devices, receive the following tracktrace on crashlytics:

java.util.Objects.requireNonNull (Objects.java:207)
com.reactnativecommunity.blurview.BlurViewManagerImpl.createViewInstance (BlurViewManagerImpl.java:22)
com.reactnativecommunity.blurview.BlurViewManager.createViewInstance (BlurViewManager.java:22)
com.reactnativecommunity.blurview.BlurViewManager.createViewInstance (BlurViewManager.java:12)
com.facebook.react.uimanager.ViewManager.createViewInstance (ViewManager.java:183)
com.facebook.react.uimanager.ViewManager.createView (ViewManager.java:115)
com.facebook.react.uimanager.NativeViewHierarchyManager.createView (NativeViewHierarchyManager.java:281)
com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute (UIViewOperationQueue.java:194)
com.facebook.react.uimanager.UIViewOperationQueue$1.run (UIViewOperationQueue.java:909)
com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches (UIViewOperationQueue.java:1026)
com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded (UIViewOperationQueue.java:984)
com.facebook.react.bridge.GuardedRunnable.run (GuardedRunnable.java:30)
android.os.Handler.handleCallback (Handler.java:984)
android.os.Handler.dispatchMessage (Handler.java:104)
android.os.Looper.loopOnce (Looper.java:238)
android.os.Looper.loop (Looper.java:357)
android.app.ActivityThread.main (ActivityThread.java:8088)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:548)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:957)

Using:

"@react-native-community/blur": "^4.4.0",
"react-native": "0.72.5",
truongnguyen3 commented 1 month ago

Same as @elgambet, I have this problem too, only happens on prod for some devices. here's the error in Appcenter Crashlytics

java.util.Objects.requireNonNull Objects.java:207
com.reactnativecommunity.blurview.BlurViewManagerImpl.createViewInstance BlurViewManagerImpl.java:22
com.reactnativecommunity.blurview.BlurViewManager.createViewInstance BlurViewManager.java:22
com.reactnativecommunity.blurview.BlurViewManager.createViewInstance BlurViewManager.java:12
com.facebook.react.uimanager.ViewManager.createViewInstance ViewManager.java:183
com.facebook.react.uimanager.ViewManager.createView ViewManager.java:115
com.facebook.react.uimanager.NativeViewHierarchyManager.createView NativeViewHierarchyManager.java:281
com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute UIViewOperationQueue.java:194
com.facebook.react.uimanager.UIViewOperationQueue$1.run UIViewOperationQueue.java:909
com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches UIViewOperationQueue.java:1026
com.facebook.react.uimanager.UIViewOperationQueue.access$2600 UIViewOperationQueue.java:47
com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded UIViewOperationQueue.java:984
com.facebook.react.bridge.GuardedRunnable.run GuardedRunnable.java:30
android.os.Handler.handleCallback Handler.java:942

Using:

"@react-native-community/blur": "^4.4.0",
"react-native": "0.72.15",