wix / react-native-ui-lib

UI Components Library for React Native
https://wix.github.io/react-native-ui-lib/
MIT License
6.53k stars 712 forks source link

Android null pointer crash at splash screen #2875

Closed ddx-510 closed 9 months ago

ddx-510 commented 10 months ago

Description

Using expo. When creating a release preview build, the Android app will crash at the splash screen. When opening logcat at android studio, it points to reactScreenMonitor.java line 65 , null pointer issue

Related to

Steps to reproduce

  1. open the app
  2. crash at splash screen immediately

Expected behavior

Go inside the main page.

Actual behavior

Crash

More Info

Code snippet

PID: 12852 java.lang.NullPointerException: 
Attempt to invoke virtual method 'android.view.View android.view.Window.getDecorView()' on a null object reference at com.wix.reactnativeuilib.keyboardinput.ReactScreenMonitor.registerWindowLayoutListener(ReactScreenMonitor.java:65) 
at com.wix.reactnativeuilib.keyboardinput.ReactScreenMonitor.onHostResume(ReactScreenMonitor.java:51) 
at com.facebook.react.bridge.ReactContext.onHostResume(ReactContext.java:308) 
at com.facebook.react.ReactInstanceManager.moveToResumedLifecycleState(ReactInstanceManager.java:778) 
at com.facebook.react.ReactInstanceManager.moveReactContextToCurrentLifecycleState(ReactInstanceManager.java:813) 
at com.facebook.react.ReactInstanceManager.-$$Nest$mmoveReactContextToCurrentLifecycleState(Unknown Source:0) 
at com.facebook.react.ReactInstanceManager$6.run(ReactInstanceManager.java:1202)
at android.os.Handler.handleCallback(Handler.java:958) at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loopOnce(Looper.java:222) at android.os.Looper.loop(Looper.java:314) 
at android.app.ActivityThread.main(ActivityThread.java:8530) at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:561) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1010)

Screenshots/Video

image

Environment

Affected platforms

Svarto commented 9 months ago

same issue

ddx-510 commented 9 months ago

@Svarto I have forked and created my package (since maintainers have not approved my pr) and it fixed this bug.

If you need you can either check my pr #2878 and fix it by yourself, or you can use my package as a temporary solution :) https://www.npmjs.com/package/@ddx0510/react-native-ui-lib

asindhu commented 9 months ago

Thanks folks... I believe I have this issue as well. Was incredibly time-consuming to debug because it is not reproducible for me in any emulator or dev environment, only on a production build on a device. There were no stack trace, logs, or error info of any kind. Just once I got a null pointer exception similar to what's referenced above, after installing Sentry, but it was never clear whether this was related to my issue or not, since Sentry only captured it once out of the hundreds of times my app crashed.

I had to strip my app down to 0 and re-install modules one-by-one, fully rebuilding an Android bundle and installing it on a device on every change, to identify which of my modules was causing the problem -- indeed it was RNUILib.

Given that this issue crashes the app on startup and makes apps unusable on Android, hopefully it will be escalated and fixed soon. Has anyone had any luck reverting to an older version of RNUILib without the issue?

brahimjid commented 9 months ago

me too app crash on open
Screenshot 2024-01-06 010232

asindhu commented 9 months ago

@Svarto I have forked and created my package (since maintainers have not approved my pr) and it fixed this bug.

If you need you can either check my pr #2878 and fix it by yourself, or you can use my package as a temporary solution :) https://www.npmjs.com/package/@ddx0510/react-native-ui-lib

This worked like a charm, thank you so much!!

brahimjid commented 9 months ago

@Svarto I have forked and created my package (since maintainers have not approved my pr) and it fixed this bug. If you need you can either check my pr #2878 and fix it by yourself, or you can use my package as a temporary solution :) https://www.npmjs.com/package/@ddx0510/react-native-ui-lib

This worked like a charm, thank you so much!!

@Svarto I have forked and created my package (since maintainers have not approved my pr) and it fixed this bug. If you need you can either check my pr #2878 and fix it by yourself, or you can use my package as a temporary solution :) https://www.npmjs.com/package/@ddx0510/react-native-ui-lib

This worked like a charm, thank you so much!!

are you using expo ?

asindhu commented 9 months ago

@Svarto I have forked and created my package (since maintainers have not approved my pr) and it fixed this bug. If you need you can either check my pr #2878 and fix it by yourself, or you can use my package as a temporary solution :) https://www.npmjs.com/package/@ddx0510/react-native-ui-lib

This worked like a charm, thank you so much!!

@Svarto I have forked and created my package (since maintainers have not approved my pr) and it fixed this bug. If you need you can either check my pr #2878 and fix it by yourself, or you can use my package as a temporary solution :) https://www.npmjs.com/package/@ddx0510/react-native-ui-lib

This worked like a charm, thank you so much!!

are you using expo ?

Yes, using Expo and managed workflow.

M-i-k-e-l commented 9 months ago

Should be fixed by #2878