Skip to content

Crash on app launch at com.google.firebase.sessions.SessionLifecycleService$MessageHandler.maybeSendSessionToClient  #6323

@xxrlzzz

Description

@xxrlzzz

Android version: 14,13,12,11,10...
Firebase version:
firebase-crashlytics:19.0.1
firebase-analytics:22.0.1

Steps to reproduce:
app crash after init firebase sdk

Relevant Code:
Exception java.lang.IllegalStateException:
at com.google.firebase.FirebaseApp.getInstance (FirebaseApp.java:179)
at com.google.firebase.FirebaseKt.getApp (Firebase.kt:42)
at com.google.firebase.sessions.SessionDatastore$Companion.getInstance (SessionDatastore.kt:56)
at com.google.firebase.sessions.SessionLifecycleService$MessageHandler.maybeSendSessionToClient (SessionLifecycleService.kt:153)
at com.google.firebase.sessions.SessionLifecycleService$MessageHandler.handleClientBound (SessionLifecycleService.kt:124)
at com.google.firebase.sessions.SessionLifecycleService$MessageHandler.handleMessage (SessionLifecycleService.kt:82)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loopOnce (Looper.java:230)
at android.os.Looper.loop (Looper.java:319)
at android.os.HandlerThread.run (HandlerThread.java:67)

After upgrade our firebase sdk, crash start. We notice that introduce from firebase-sessions, it require Firebase.app finish initialization during sdk init, which cause a potential circular dependencies. Plz check this crash as soon as possible.

    private fun maybeSendSessionToClient(client: Messenger) {
      if (hasForegrounded) {
        sendSessionToClient(client, SessionGenerator.instance.currentSession.sessionId)
      } else {
        // Send the value from the datastore before the first foregrounding it exists
        val storedSession = SessionDatastore.instance.getCurrentSessionId()
        Log.d(TAG, "App has not yet foregrounded. Using previously stored session: $storedSession")
        storedSession?.let { sendSessionToClient(client, it) }
      }
    }
  companion object {
    val instance: SessionDatastore
      get() = Firebase.app[SessionDatastore::class.java]
  }
// firebase-common/src/main/java/com/google/firebase/Firebase.kt
val Firebase.app: FirebaseApp
  get() = FirebaseApp.getInstance()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions