OneSignal-Android-SDK icon indicating copy to clipboard operation
OneSignal-Android-SDK copied to clipboard

Fatal Exception: java.lang.NullPointerException com.onesignal.OneSignalDbHelper.getInstance

Open alekssunsss opened this issue 4 years ago • 8 comments

Description:

We do not how to reproduce the issue, but we have a lot of crashes in Crashlytics console. Seems like happens on Amazon devices only with android version 5.1.1.

Environment

  1. Android target SDK 29
  2. OneSignal sdk 4.0.0-4.1.0
  3. Devices are 5.1.1 KFFOWI 5.1.1 KFGIWI 5.1.1 KFASWI 5.1.1 KFARWI 5.1.1 KFTBWI

Steps to Reproduce Issue:

  1. Looks like it happens when we send push notifications to our application users with OneSignal 4.1.0 integrated

Anything else:

(crash stacktraces, as well as any other information here)

Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference

com.onesignal.OneSignalDbHelper.getInstance (OneSignalDbHelper.java:132)
com.onesignal.OneSignal.getDBHelperInstance (OneSignal.java:2999)
com.onesignal.OneSignal.isDuplicateNotification (OneSignal.java:2826)
com.onesignal.OneSignal.notValidOrDuplicated (OneSignal.java:2856)
com.onesignal.NotificationBundleProcessor.startNotificationProcessing (NotificationBundleProcessor.java:414)
com.onesignal.NotificationBundleProcessor.processBundleFromReceiver (NotificationBundleProcessor.java:380)
com.onesignal.ADMMessageHandler.onMessage (ADMMessageHandler.java:74)
com.amazon.device.messaging.ADMMessageHandlerBase.onHandleIntent (ADMMessageHandlerBase.java:85)
android.app.IntentService$ServiceHandler.handleMessage (IntentService.java:65)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:135)
android.os.HandlerThread.run (HandlerThread.java:61)

alekssunsss avatar Feb 18 '21 14:02 alekssunsss

Thanks for reporting. I believe the issue has to do with OneSignal not calling OneSignal.initWithContext() internally in com.onesignal.ADMMessageHandler.onMessage and com.onesignal.ADMMessageHandlerJob.onMessage.

This is something that can be added to fix this issue and some integration tests implemented to prevent a regression in the future.

jkasten2 avatar Mar 12 '21 07:03 jkasten2

@jkasten2 is there any updates about fixes for the issue posted above?

alexeybaiburin avatar May 13 '21 08:05 alexeybaiburin

Any update here, we are also facing the same issue?

ArsalImam avatar May 22 '21 19:05 ArsalImam

Any update here, we are also facing the same issue?

Mrllopes avatar Aug 24 '21 12:08 Mrllopes

We're seeing this too, in latest OneSignal React Native. On all types of devices, not just Amazon

jacklj avatar Mar 09 '23 00:03 jacklj

We are seeing it too:

IMG_5726

theonetheycallneo avatar Jul 19 '23 02:07 theonetheycallneo

any luck on this one? also having this one coming on Sentry.

  • "react-native-onesignal": "4.5.1",
  • "react-native": "0.71.3",

vlimag avatar Aug 07 '23 16:08 vlimag

me too!

"react-native-onesignal": "^4.5.1",

newme616 avatar Aug 15 '23 06:08 newme616

For those seeing this issue on Amazon devices this should now be fixed in 5.1.7. If you continue to see a crash please open a new ticket, providing the new stacktrace.

If you see an issue sending Amazon notifications please see https://github.com/OneSignal/OneSignal-Android-SDK/issues/1936#issuecomment-2024161687

We're seeing this too, in latest OneSignal React Native. On all types of devices, not just Amazon

@jacklj This issue thread is specific to Amazon devices, if you are seeing a similar issue please open a new issue, as the stacktrace will be different for non-Amazon devices.

jkasten2 avatar Mar 29 '24 18:03 jkasten2