React-native-onesignal: [CRASH][ANDROID] Attempt to invoke virtual method 'boolean android.app.NotificationChannel.isDeleted()' on a null object reference

Created on 23 Jan 2021  ·  8Comments  ·  Source: OneSignal/react-native-onesignal

Description:

Crash on Android reported by crashlytics from some users.

Environment
Packages

"react": "16.13.1",
"react-native": "0.63.4",
"react-native-onesignal": "^4.0.3",

Device

Android: 8
Devices: HUAWEI P10 lite,  Sasmung Galaxy S8

Steps to Reproduce Issue:
Receive a push notification OneSignal.
I don't have more informations.

Anything else:

Error

Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'boolean android.app.NotificationChannel.isDeleted()' on a null object reference

Stack Trace

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.app.NotificationChannel.isDeleted()' on a null object reference
       at android.os.Parcel.readException(Parcel.java:1960)
       at android.os.Parcel.readException(Parcel.java:1900)
       at android.app.INotificationManager$Stub$Proxy.getNotificationChannels(INotificationManager.java:1618)
       at android.app.NotificationManager.getNotificationChannels(NotificationManager.java:515)
       at com.onesignal.NotificationChannelManager.processChannelList(NotificationChannelManager.java:236)
       at com.onesignal.OneSignal$5.complete(OneSignal.java:970)
       at com.onesignal.OneSignalRemoteParams.processJson(OneSignalRemoteParams.java:205)
       at com.onesignal.OneSignalRemoteParams.access$100(OneSignalRemoteParams.java:12)
       at com.onesignal.OneSignalRemoteParams$1.onSuccess(OneSignalRemoteParams.java:150)
       at com.onesignal.OneSignalRestClient$5.run(OneSignalRestClient.java:269)
       at java.lang.Thread.run(Thread.java:784)
Help Wanted Possible Bug

Most helpful comment

Hi there,
I got the same problem. One user got around 218 crashes in one single day in Crashlytics.
Device brand - Oppo
Os version - 9
Stack trace-
com.onesignal.NotificationChannelManager.processChannelList
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.app.NotificationChannel.isDeleted()' on a null object reference

Is there any solution yet?

All 8 comments

got?

Howdy,
Thank you so much for the stack trace.

@Jeasmine coming from here.

From a surface-level it seems that the OneSignal Notification Manager is tracking references to channels that at some point get deleted and are thus null.

We will have to dig into this a bit further.

Thank you for reporting this.

@Jeasmine @rgomezp Another report of this on Native Android SDK com.onesignal:OneSignal:[4.0.0, 4.99.99]
99% of crashes on Samsung Galaxy SM-G950F (Android 9) (1 user only)
Unfortunately don't know steps for reproduce.

1 - Tried disabling an app group on my device and sending push, but did not crash.
2 - Tried saving the android_channel_id to my api requests, delete the id, no crash
3 - Tried renaming the android_channel_id, no change

@kperreau @luan-nvg any other ideas on what you tried to help us reproduce?

Are you using custom android channel ids or OneSignal android channel ids?

Hi there, I also got the same problem but my app running on Native Android SDK, no open issue there so I'll comment here. Here is some information regarding the issue that happens to me:

  1. OneSignal SDK is 4.0.0
  2. Device is Android 9, Oppo Realme C1, 90% happens on background, currently, 87 events occurred, and only this user
  3. Don't know how to reproduce since it's a very small user, and we don't have the device to test
  4. The code part that causing the problem is the same as @rgomezp mentioned before

Is there's anything I can do to maybe handle or catch it for now? Quite worrying to see the occurrence of the crash, thank you

Any news ? I got some bad review on Play Store because of this crash.
Samsung S8 user (Android 9) got instant crash at startup.

@jfishman1 I'm using custom android channel ids.

Hi there,
I got the same problem. One user got around 218 crashes in one single day in Crashlytics.
Device brand - Oppo
Os version - 9
Stack trace-
com.onesignal.NotificationChannelManager.processChannelList
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.app.NotificationChannel.isDeleted()' on a null object reference

Is there any solution yet?

Hi @rgomezp ,
Any update on this yet? Got around 2-3k crashes to date from this issue. My Crashlytics reports are messed up because of this. Please provide a solution.

Was this page helpful?
0 / 5 - 0 ratings