Skip to content

[Bug]: 5.4.0 Crash on init for some phones, Caused by java.lang.IllegalStateException: initWithContext was not called or timed out #2407

@jt-gilkeson

Description

@jt-gilkeson

What happened?

We updated to 5.4.0 and see a new crash in firebase: We haven't changed our init code in 2 years, the only change was updating from 5.1.37 to 5.4.0

Caused by java.lang.IllegalStateException
initWithContext was not called or timed out
com.onesignal.internal.OneSignalImp.waitForInit (OneSignalImp.kt:339)
com.onesignal.internal.OneSignalImp.waitAndReturn (OneSignalImp.kt:393)
com.onesignal.internal.OneSignalImp.getLocation (OneSignalImp.kt:123)
com.onesignal.OneSignal.getLocation (OneSignal.kt:70)
OurApplication.configureNotificationsService (OurApplication.kt:276)
OurApplication.onCreate (OurApplication.kt:141)
android.app.Instrumentation.callApplicationOnCreate (Instrumentation.java:1381)
 private fun configureNotificationsService() {
        OneSignal.initWithContext(this, BuildConfig.ONESIGNAL_API_KEY)
        OneSignal.Location.isShared = false // https://github.com/OneSignal/OneSignal-Android-SDK/issues/1821
        OneSignal.Notifications.addClickListener(PushNotificationOpenedHandlerObserver(this))
        OneSignal.User.pushSubscription.addObserver(pushNotificationSubscriberObserver)

        registerInAppPushNotificationChannels()
    }

Steps to reproduce?

1. Update from 5.1.37 to 5.4.0
2. Launch App

What did you expect to happen?

I expected the app not to crash on ini

OneSignal Android SDK version

5.4.0

Android version

15

Specific Android models

Event summary
OS version: android16
Model:Moto G Power - 2025
Date:Nov 11, 2025, 1:18:12 AM

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions