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]: PermissionsActivity crash #1720

Closed
1 task done
sebastinto opened this issue Jan 16, 2023 · 6 comments
Closed
1 task done

[Bug]: PermissionsActivity crash #1720

sebastinto opened this issue Jan 16, 2023 · 6 comments
Assignees

Comments

@sebastinto
Copy link

sebastinto commented Jan 16, 2023

What happened?

The crash was reported in Crashlytics.

It seems to be related to this: OneSignal/OneSignal-Unity-SDK#529 since the stack trace is very similar. Also happening on a Nexus 5X running Android 8 like other reports.

Important to note is that we handle permissions outside of the OneSignal SDK i.e. we don't call promptForPushNotifications()

Also important to note is that the same device reported a crash with the same cause coming from the androidx.profileinstaller:profileinstaller library (which we strangely don't use in our app). There's also this very similar report in the issue tracker coming from the Google Play Core library: https://issuetracker.google.com/issues/200437477

Gradle

dependencies {
    implementation 'com.onesignal:OneSignal:[4.0.0, 4.99.99]'
}

Steps to reproduce?

Unfortunately, since it's a crash reported in Crashlytics, I haven't been able to reproduce.

What did you expect to happen?

No crash

OneSignal Android SDK version

latest

Android version

8

Specific Android models

Nexus 5X (8.1)

Relevant log output

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.xxx/com.onesignal.PermissionsActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.os.Bundle.getString(java.lang.String)' on a null object reference
    android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
    android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
    android.app.ActivityThread.-wrap11(:0)
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
    android.os.Handler.dispatchMessage(Handler.java:106)
    android.os.Looper.loop(Looper.java:164)
    android.app.ActivityThread.main(ActivityThread.java:6494)
    java.lang.reflect.Method.invoke(Method.java:0)
    com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.os.Bundle.getString(java.lang.String)' on a null object reference
    com.onesignal.PermissionsActivity.reregisterCallbackHandlers(PermissionsActivity.java:109)
    com.onesignal.PermissionsActivity.handleBundleParams(PermissionsActivity.java:100)
    com.onesignal.PermissionsActivity.onCreate(PermissionsActivity.java:82)
    android.app.Activity.performCreate(Activity.java:7009)
    android.app.Activity.performCreate(Activity.java:7000)
    android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
    android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
    android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
    android.app.ActivityThread.-wrap11(:0)
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
    android.os.Handler.dispatchMessage(Handler.java:106)
    android.os.Looper.loop(Looper.java:164)
    android.app.ActivityThread.main(ActivityThread.java:6494)
    java.lang.reflect.Method.invoke(Method.java:0)
    com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Code of Conduct

  • I agree to follow this project's Code of Conduct
@brismithers
Copy link
Contributor

Hi @sebastinto thanks for the detailed report!

Are you able to confirm if this is occurring to an actual user? From the comments in the referenced issue my theory is automatic testing done by the google play store is explicitly driving the PermissionsActivity, rather than it be driven via the OneSignal SDK code here. In a "real world" scenario I don't see how PermissionsActivity would be started without the SDK providing extras on the intent.

We can update our Activity to do additional checking onCreate to make sure extras were provided, but I am viewing this as a more minor issue to be fixed in the upcoming major release. Please let me know if you are able to see this in a real world scenario. Thanks!

@sebastinto
Copy link
Author

@brismithers I cannot confirm that it happened to a real user. You may be onto something with your theory that it's driven by automated play store testing since the crash was reported not long after uploading a new version of the app to the Google Play Store.

@octifi-raj
Copy link

octifi-raj commented Apr 24, 2023

@sebastinto Recently reported by Crashlytics. Device Model: Pixel 3 XL (Android 9)

@jeluchu
Copy link

jeluchu commented May 19, 2023

Same problem in:
Nexus 5X (Android 8.1.0)

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jeluchu.example/com.onesignal.PermissionsActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.os.BaseBundle.getString(java.lang.String)' on a null object reference
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
       at android.app.ActivityThread.-wrap11()
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6494)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.os.BaseBundle.getString(java.lang.String)' on a null object reference
       at com.onesignal.PermissionsActivity.reregisterCallbackHandlers(PermissionsActivity.java:109)
       at com.onesignal.PermissionsActivity.handleBundleParams(PermissionsActivity.java:100)
       at com.onesignal.PermissionsActivity.onCreate(PermissionsActivity.java:82)
       at android.app.Activity.performCreate(Activity.java:7009)
       at android.app.Activity.performCreate(Activity.java:7000)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
       at android.app.ActivityThread.-wrap11()
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6494)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

@ejain
Copy link

ejain commented Jun 7, 2023

Just noticed this, too, captured on a Pixel 3a running Android 12, react-native-onesignal@4.5.0.

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.os.Bundle.getString(java.lang.String)' on a null object reference
    at com.onesignal.PermissionsActivity.reregisterCallbackHandlers(PermissionsActivity.java:109)
    at com.onesignal.PermissionsActivity.handleBundleParams(PermissionsActivity.java:100)
    at com.onesignal.PermissionsActivity.onCreate(PermissionsActivity.java:82)
    at android.app.Activity.performCreate(Activity.java:8051)
    at android.app.Activity.performCreate(Activity.java:8031)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3608)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3792)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2210)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7838)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.bloomapi.bloomtext/com.onesignal.PermissionsActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.os.Bundle.getString(java.lang.String)' on a null object reference
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3635)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3792)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2210)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7838)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

We do call OneSignal.promptForPushNotificationsWithUserResponse in the app, not sure if this error could be caught?

@jennantilla
Copy link
Contributor

Hello everyone! Apologies that this issue has gone stale. Much of our work in the last few quarters have been on a new major release where many improvements and enhancements are introduced. We will continue to investigate 4.x.x bugs, though we encourage you to update to our latest release as that will be the most-supported release going forward. Please see our migration guide for full details on upgrading and let us know if you have any questions!

If this crash is still a current concern, please let us know and we will investigate further. Thanks!

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

No branches or pull requests

6 participants