Skip to content

ANR during FirebaseInitProvider.onCreate - SimpleArrayMap/ContainerHelpersKt class initialization #7876

@ZeeshanShabbir

Description

@ZeeshanShabbir

[READ] Step 1: Are you in the right place?

  • For general technical questions, post a question on StackOverflow
    with the firebase tag.
  • For general Firebase discussion, use the
    firebase-talk google group.
  • For help troubleshooting your application that does not fall under one of the above categories,
    reach out to the personalized Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: Android Studio Otter | 2025.2.1 Patch 1
  • Firebase Component: Firebase Core (firebase-common)
  • Component version: BOM 34.3.0

[REQUIRED] Step 3: Describe the problem

We are seeing ANRs during app cold start caused by slow class static initialization (<clinit>) in FirebaseApp triggered by FirebaseInitProvider.onCreate() on the main thread. The main thread is blocked performing class loading/verification of androidx.collection.SimpleArrayMap and ContainerHelpersKt with no lock contention and all other threads are idle.
This impacts lower-end devices during cold start. Since FirebaseInitProvider runs as a ContentProvider it blocks the entire app startup path before Application.onCreate() is even called.
We are already on the latest androidx.collection (1.5.0 resolved).

Steps to reproduce:

Cannot reproduce locally. Observed in production via Crashlytics on lower-end devices during cold start.

"main" tid=1 Runnable
  at androidx.collection.SimpleArrayMap.<init> (SourceFile:65354)
  at com.google.firebase.FirebaseApp.<clinit> (SourceFile:65354)
  at com.google.firebase.provider.FirebaseInitProvider.onCreate (SourceFile:65348)
  at android.content.ContentProvider.attachInfo (ContentProvider.java:2648)
  at android.content.ContentProvider.attachInfo (ContentProvider.java:2616)
  at com.google.firebase.provider.FirebaseInitProvider.attachInfo (SourceFile:65352)
  at android.app.ActivityThread.installProvider (ActivityThread.java:8490)
  at android.app.ActivityThread.installContentProviders (ActivityThread.java:8003)
  at android.app.ActivityThread.handleBindApplication (ActivityThread.java:7667)

Stack trace 2:

  at androidx.collection.internal.ContainerHelpersKt.<clinit> (SourceFile:65354)
  at androidx.collection.SimpleArrayMap.<init> (SourceFile:65354)
  at com.google.firebase.FirebaseApp.<clinit> (SourceFile:65354)
  at com.google.firebase.provider.FirebaseInitProvider.onCreate (SourceFile:65348)
  at android.content.ContentProvider.attachInfo (ContentProvider.java:2648)
  at android.content.ContentProvider.attachInfo (ContentProvider.java:2616)
  at com.google.firebase.provider.FirebaseInitProvider.attachInfo (SourceFile:65352)
  at android.app.ActivityThread.installProvider (ActivityThread.java:8490)
  at android.app.ActivityThread.installContentProviders (ActivityThread.java:8003)
  at android.app.ActivityThread.handleBindApplication (ActivityThread.java:7667)

In both cases, all other threads (binder, daemon, SharedPreferences, etc.) are idle or in waiting state — no lock contention is involved.

What happened? How can we make the problem occur? This could be a description, log/console output,
etc.

Device & OS breakdown

Android versions: Android 15 (SDK 35), Android 16 Beta (SDK 36)
Visibility: Foreground
Top affected devices:

  • realme RE6095
  • realme RE6054
  • realme RE58BC
  • realme RE5C9F

Relevant Code:

// No app code involved. ANR occurs before Application.onCreate() 
// during ContentProvider initialization triggered by the system.
// FirebaseInitProvider is auto-merged into the manifest by the Firebase SDK.
Image

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