Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: (Unity/Android) com.onesignal.common.modeling.Model.getStringProperty (java.lang.NullPointerException) #1781

Closed
devyte opened this issue May 22, 2023 · 4 comments

Comments

@devyte
Copy link

devyte commented May 22, 2023

What happened?

This report is almost identical to #1745 with one minor difference: in our case the crash happens in BootUpReceiver instead of UpgradeReceiver.

Our application was on v5.0.0-beta1 of the Unity SDK. We started seeing crashes in the google play console related to onesignal. We then saw that beta2 came out, so tried upgrading, but crashes keep showing up, see the full stacktrace below.

To be explicit, the stacktrace attached below was pulled from builds using beta2.

My suspicion is that the PR for #1745 missed a fix in some obscure code corner, but that's just a wild guess.

Steps to reproduce?

Our use is pretty basic: we call `OneSignal.Default.Initialize("SomeAppIdHere")` after which we check permissions.

What did you expect to happen?

I expect no crashes.

OneSignal Android SDK version

v5.0.0-beta2

Android version

13, 12, 11, 10, 9, 8

Specific Android models

Over 400 different devices total, way too many to list here in detail, but here are some of the top ones:

Samsung:
* j2 core lte
* a01 core
* a3 core
* a12/s, a13, a21s, a03, a10s, a33x, a51
* bunch of others

Motorola:
* cypfq
* pokerp
* caprip
* maltalsc
* bunch of others

LG
* mdh35lm

ZTE:
* P731F50
* P731F20

Relevant log output

Type `java.lang.RuntimeException`

Exception java.lang.RuntimeException: Unable to start receiver com.onesignal.notifications.receivers.BootUpReceiver: java.lang.NullPointerException: null cannot be cast to non-null type kotlin.String
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:3210)
  at android.app.ActivityThread.-wrap17
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1678)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:164)
  at android.app.ActivityThread.main (ActivityThread.java:6543)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:440)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:810)
Caused by java.lang.NullPointerException: null cannot be cast to non-null type kotlin.String
  at com.onesignal.common.modeling.Model.getStringProperty (Model.kt:215)
  at com.onesignal.common.modeling.Model.getStringProperty$default (Model.kt:215)
  at com.onesignal.core.internal.config.ConfigModel.getAppId (ConfigModel.kt:12)
  at com.onesignal.user.internal.operations.impl.listeners.SubscriptionModelStoreListener.getAddOperation (SubscriptionModelStoreListener.kt:24)
  at com.onesignal.user.internal.operations.impl.listeners.SubscriptionModelStoreListener.getAddOperation (SubscriptionModelStoreListener.kt:15)
  at com.onesignal.core.internal.operations.listeners.ModelStoreListener.onModelAdded (ModelStoreListener.kt:36)
  at com.onesignal.common.modeling.ModelStore$addItem$1.invoke (ModelStore.kt:110)
  at com.onesignal.common.modeling.ModelStore$addItem$1.invoke (ModelStore.kt:110)
  at com.onesignal.common.events.EventProducer.fire (EventProducer.kt:40)
  at com.onesignal.common.modeling.ModelStore.addItem (ModelStore.kt:110)
  at com.onesignal.common.modeling.ModelStore.addItem$default (ModelStore.kt:98)
  at com.onesignal.common.modeling.ModelStore.add (ModelStore.kt:46)
  at com.onesignal.common.modeling.ModelStore.replaceAll (ModelStore.kt:81)
  at com.onesignal.common.modeling.IModelStore$DefaultImpls.replaceAll$default (IModelStore.kt:81)
  at com.onesignal.internal.OneSignalImp.createAndSwitchToNewUser (OneSignalImp.kt:396)
  at com.onesignal.internal.OneSignalImp.createAndSwitchToNewUser$default (OneSignalImp.kt:343)
  at com.onesignal.internal.OneSignalImp.initWithContext (OneSignalImp.kt:202)
  at com.onesignal.OneSignal.initWithContext (OneSignal.kt:196)
  at com.onesignal.notifications.receivers.BootUpReceiver.onReceive (BootUpReceiver.kt:38)
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:3203)


### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

<!-- probot = {"onesignal-probot":{"response_time_in_business_days":7}} -->
@jennantilla
Copy link
Contributor

Hi @devyte, thanks for reaching out! We're looking into this and will get back to you as soon as possible.

@jennantilla
Copy link
Contributor

Hi @devyte! If you upgrade your Unity SDK to 5.0.0-beta.3 this should resolve the issue!

@devyte
Copy link
Author

devyte commented Jun 1, 2023

@jennantilla Thank you very much! I already see the new version in the Unity package manager, so I'll coordinate checking this on our side ASAP.

@jennantilla
Copy link
Contributor

@devyte I'll go ahead and close this issue but please let us know if you are still facing any difficulties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants