Onesignal-android-sdk: [4.0.0-beta2] java.lang.NullPointerException: Attempt to read from field 'android.content.Context

Created on 22 Oct 2020  路  8Comments  路  Source: OneSignal/OneSignal-Android-SDK

Description:

Hello folks, I'd like to report a crash that we had on our app after updating to 4.0.0-beta2 version.
I'm attaching some relevant information from crashlytics.

Environment

  1. OneSignal SDK version: 4.0.0-beta2.
  2. Compile SDK 29
  3. Target SDK 29
  4. Installed via Gradle.
  5. Crash report observed on Android 10 device while the app was in the background.
  6. User Device: Galaxy S20+ 5G.

Steps to Reproduce Issue:

Unknown at the moment. It's a crash report via Firebase Crashlytics.

Anything else:

Stacktrace

Fatal Exception: java.lang.NullPointerException: Attempt to read from field 'android.content.Context com.onesignal.DelayedConsentInitializationParameters.context' on a null object reference
       at com.onesignal.OneSignal.reassignDelayedInitParams(OneSignal.java:972)
       at com.onesignal.OneSignal.onRemoteParamSet(OneSignal.java:726)
       at com.onesignal.OneSignal$5.complete(OneSignal.java:934)
       at com.onesignal.OneSignalRemoteParams.processJson(OneSignalRemoteParams.java:203)
       at com.onesignal.OneSignalRemoteParams.access$100(OneSignalRemoteParams.java:12)
       at com.onesignal.OneSignalRemoteParams$1.onSuccess(OneSignalRemoteParams.java:149)
       at com.onesignal.OneSignalRestClient$5.run(OneSignalRestClient.java:269)
       at java.lang.Thread.run(Thread.java:919)
Beta Possible Bug

Most helpful comment

Hey @cmargonis sorry for the delayed answer! but we will release a fix for this on the next beta cut release

All 8 comments

We're seeing this as well on 4.0.0-beta2. We've had five devices crash so far, LGs and Samsungs running Android 8 and Android 10, all while in the background.

Hey @cmargonis, thanks in advance for using the beta version and your feedback, we will take a look.

Just an update on my earlier comment, we rolled out an app update with beta2 to more users and this crash has impacted ~1.5% of them. Same stack trace as above, always in background. Haven't reproduced locally but we have ~9k distinct crashes in Firebase Crashlytics.

Also, wasn't sure if I should open a new issue for this, but we've had ~300 crashes with a very similar stack trace as well:

Fatal Exception: java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.onesignal.DelayedConsentInitializationParameters.appId' on a null object reference
       at com.onesignal.OneSignal.reassignDelayedInitParams(OneSignal.java:973)
       at com.onesignal.OneSignal.onRemoteParamSet(OneSignal.java:726)
       at com.onesignal.OneSignal$5.complete(OneSignal.java:934)
       at com.onesignal.OneSignalRemoteParams.processJson(OneSignalRemoteParams.java:203)
       at com.onesignal.OneSignalRemoteParams.access$100(OneSignalRemoteParams.java:12)
       at com.onesignal.OneSignalRemoteParams$1.onSuccess(OneSignalRemoteParams.java:149)
       at com.onesignal.OneSignalRestClient$5.run(OneSignalRestClient.java:269)
       at java.lang.Thread.run(Thread.java:919)

@cmargonis Do you have shared location active?

Hello @Jeasmine ,thanks for taking a look 馃槉 No, our app doesn't use location at all.

Hey @cmargonis sorry for the delayed answer! but we will release a fix for this on the next beta cut release

Thanks @Jeasmine that's great 馃槃

4.0.0-beta3 is now released with fix noted above.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sannyo picture sannyo  路  7Comments

mohsinnaqvi110 picture mohsinnaqvi110  路  4Comments

joelfernandes19 picture joelfernandes19  路  6Comments

himgupta picture himgupta  路  7Comments

kareemzok picture kareemzok  路  4Comments