OneSignal / react-native-onesignal

React Native Library for OneSignal Push Notifications Service
Other
1.56k stars 373 forks source link

Android app crashes on production #1364

Open biswanathTewari opened 2 years ago

biswanathTewari commented 2 years ago

Description:

We recently published our android app on production, 8th Feb. We have been facing app crashes ever since then.

Environment

"react-native": "0.63.4" using npm "react-native-onesignal": "^4.0.8", 'com.android.tools.build:gradle:4.1.1' compileSdkVersion 31, buildToolsVersion "29.0.3", targetSdkVersion 31.

crash stacktraces:

java.lang.NullPointerException: at com.onesignal.OneSignalDbHelper.getInstance (OneSignalDbHelper.java:132) at com.onesignal.OneSignal.getDBHelperInstance (OneSignal.java:3170) at com.onesignal.OneSignal.getInAppMessageController (OneSignal.java:429) at com.onesignal.OneSignal.addTriggers (OneSignal.java:2934) at com.geektime.rnonesignalandroid.RNOneSignal.addTriggers (RNOneSignal.java:549) at java.lang.reflect.Method.invoke (Native Method) at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:372) at com.facebook.react.bridge.JavaModuleWrapper.invoke (JavaModuleWrapper.java:151) at com.facebook.react.bridge.queue.NativeRunnable.run (Native Method) at android.os.Handler.handleCallback (Handler.java:790) at android.os.Handler.dispatchMessage (Handler.java:99) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:27) at android.os.Looper.loop (Looper.java:192) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:226) at java.lang.Thread.run (Thread.java:764)

jkasten2 commented 2 years ago

@iambizan Thanks for reporting with the stacktrace, I have a few follow up questions.

  1. Can you reproduce this issue on your devices. If so please provide exact steps to do so.
  2. This crash is happening from addTriggers, can you share where you are calling this.
  3. Is your app doing any background work where it could be calling addTriggers?
biswanathTewari commented 2 years ago

Hi @jkasten2, thanks for replying.

  1. No we were not able to reproduce this error on our devices. It is only getting mentioned in play console.
  2. Actually we have not used addTriggers throughout our code, the only place where it is being called, is inside the node modules. But we did use addTrigger function, and we are calling that just after the app gets initialized under componentDidMount.
  3. No, our app is not performing any background task that could call addTriggers.
jacklj commented 1 year ago

Seeing the same issue on latest version (4.5.0). We are using addTrigger, but not in any background tasks.