Skip to content

Crash in FirebaseInitProvider: Caused by java.lang.ArrayIndexOutOfBoundsException #6893

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

Closed
isamotiuc opened this issue Apr 17, 2025 · 4 comments

Comments

@isamotiuc
Copy link

isamotiuc commented Apr 17, 2025

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

Yes, this issue is a crash.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 2023.2.1
  • Firebase Component: firebase-perf, firebase-core, firebase-common, firebase-initprovider
  • Component version:
    • Firebase BOM: 33.12.0 (upgraded from 33.1.0)
    • firebase-perf: [version resolved by BOM]
    • Other relevant libraries: androidx.lifecycle 2.8.7

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

After upgrading firebase-bom from 33.1.0 to 33.12.0, I started receiving crash reports from users. The crash occurs during the initialization of FirebaseInitProvider, specifically in the Firebase Performance SDK, and appears to be related to DexCache and reflection.

Important: I have not been able to reproduce this crash on my own test devices or emulators. The issue has only been observed via crash reports from users in production.

How to reproduce:
  1. Update firebase-bom to 33.12.0 in your build.gradle.
  2. Build and run the app.
  3. Some users experience a crash during startup (before any activity is shown), but it does not reproduce consistently or on all devices.

Stack trace (from user crash reports):

          Fatal Exception: java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ArrayIndexOutOfBoundsException: length=34652; index=-32275
       at android.app.ActivityThread.installProvider(ActivityThread.java:6765)
       at android.app.ActivityThread.installContentProviders(ActivityThread.java:6357)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6297)
       at android.app.ActivityThread.access$1800(ActivityThread.java:221)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1860)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:158)
       at android.app.ActivityThread.main(ActivityThread.java:7224)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

   Caused by java.lang.ArrayIndexOutOfBoundsException: length=34652; index=-32275
       at java.lang.DexCache.getResolvedType(DexCache.java)
       at java.lang.Class.getDexCacheType(Class.java:472)
       at java.lang.Class.getInterfaces(Class.java:1029)
       at java.lang.reflect.Proxy.getMethodsRecursive(Proxy.java:298)
       at java.lang.reflect.Proxy.getMethods(Proxy.java:288)
       at java.lang.reflect.Proxy.getProxyClass(Proxy.java:165)
       at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:228)
       at libcore.reflect.AnnotationFactory.createAnnotation(AnnotationFactory.java:95)
       at libcore.reflect.AnnotationAccess.toAnnotationInstance(AnnotationAccess.java:666)
       at libcore.reflect.AnnotationAccess.toAnnotationInstance(AnnotationAccess.java:641)
       at libcore.reflect.AnnotationAccess.getDeclaredAnnotation(AnnotationAccess.java:170)
       at java.lang.reflect.Method.getAnnotation(Method.java:300)
       at androidx.lifecycle.ClassesInfoCache.hasLifecycleMethods(ClassesInfoCache.java:56)
       at androidx.lifecycle.Lifecycling.resolveObserverCallbackType(Lifecycling.jvm.kt:132)
       at androidx.lifecycle.Lifecycling.getObserverConstructorType(Lifecycling.jvm.kt:116)
       at androidx.lifecycle.Lifecycling.lifecycleEventObserver(Lifecycling.java:51)
       at androidx.lifecycle.LifecycleRegistry$ObserverWithState.<init>(LifecycleRegistry.java:313)
       at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.jvm.kt:182)
       at com.google.firebase.perf.metrics.AppStartTrace.registerActivityLifecycleCallbacks(AppStartTrace.java:215)
       at com.google.firebase.perf.FirebasePerfEarly.<init>(FirebasePerfEarly.java:50)
       at com.google.firebase.perf.FirebasePerfRegistrar.lambda$getComponents$0(FirebasePerfRegistrar.java:75)
       at com.google.firebase.tracing.ComponentMonitor.lambda$processRegistrar$0(ComponentMonitor.java:38)
       at com.google.firebase.components.ComponentRuntime.lambda$discoverComponents$0(ComponentRuntime.java:160)
       at com.google.firebase.components.Lazy.get(Lazy.java:53)
       at com.google.firebase.components.ComponentRuntime.doInitializeEagerComponents(ComponentRuntime.java:322)
       at com.google.firebase.components.ComponentRuntime.initializeEagerComponents(ComponentRuntime.java:312)
       at com.google.firebase.FirebaseApp.initializeAllApis(FirebaseApp.java:607)
       at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:300)
       at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:264)
       at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:249)
       at com.google.firebase.provider.FirebaseInitProvider.onCreate(FirebaseInitProvider.java:69)
       at android.content.ContentProvider.attachInfo(ContentProvider.java:1789)
       at android.content.ContentProvider.attachInfo(ContentProvider.java:1764)
       at com.google.firebase.provider.FirebaseInitProvider.attachInfo(FirebaseInitProvider.java:61)
       at android.app.ActivityThread.installProvider(ActivityThread.java:6762)
       at android.app.ActivityThread.installContentProviders(ActivityThread.java:6357)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6297)
       at android.app.ActivityThread.access$1800(ActivityThread.java:221)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1860)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:158)
       at android.app.ActivityThread.main(ActivityThread.java:7224)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
@google-oss-bot
Copy link
Contributor

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@lehcar09
Copy link
Contributor

Hi @isamotiuc, thank you for reaching out. I'm wondering if the issue is due to a race condition or specific device. Does this issue only occur on specific devices or versions?

Can you share your gradle dependencies, and are you using custom R8 rules? Thanks in advance!

@google-oss-bot
Copy link
Contributor

Hey @isamotiuc. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@isamotiuc
Copy link
Author

The issue was related to R8, not to Firebase. It happened only on Android 6.

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

3 participants