firebase / firebase/firebase-android-sdk
ANR during FirebaseInitProvider.onCreate - SimpleArrayMap/ContainerHelpersKt class initialization
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 710
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 34
Description
### [READ] Step 1: Are you in the right place?
- For general technical questions, post a question on [StackOverflow](http://stackoverflow.com/)
with the firebase tag.
- For general Firebase discussion, use the
[firebase-talk](https://groups.google.com/forum/#!forum/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](https://firebase.google.com/support/).
### [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 ()` 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.
```Stack trace 1:
"main" tid=1 Runnable
at androidx.collection.SimpleArrayMap. (SourceFile:65354)
at com.google.firebase.FirebaseApp. (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:
```"main" tid=1 Runnable
at androidx.collection.internal.ContainerHelpersKt. (SourceFile:65354)
at androidx.collection.SimpleArrayMap. (SourceFile:65354)
at com.google.firebase.FirebaseApp. (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.
```
Contributor guide
Assessment
This issue has not been assessed yet.