You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求助:Crashlytics无法存入Kit[]数组引发ArrayStoreException异常

Fixing the ArrayStoreException with Crashlytics Initialization

Hey there, let's tackle this ArrayStoreException you're hitting when initializing Crashlytics in your SoberSplash Activity. This error usually boils down to type mismatches from dependency inconsistencies or incorrect setup, so let's walk through the fixes step by step:

Common Causes & Solutions

1. Mismatched Fabric/Crashlytics Dependency Versions

This is the most likely culprit. The error says com.crashlytics.android.Crashlytics can't be stored in an array of io.fabric.sdk.android.Kit[]—that means the Crashlytics version you're using isn't compatible with the underlying Fabric SDK version (or vice versa).

  • Fix: Ensure all Fabric-related dependencies use matching versions. For your crashlytics:2.9@aar, you need to include the corresponding Fabric SDK dependency. Add this to your module-level build.gradle:
    compile('io.fabric.sdk.android:fabric:1.4.0@aar')
    
    Double-check that versions align—Crashlytics 2.9 pairs with Fabric SDK 1.4.0, which is the compatible match for this release.

2. Correct Your Initialization Code

If you're manually creating a Kit[] array to pass to Fabric.with(), this could be causing the type mismatch (especially with version conflicts). Stick to the standard initialization pattern:

  • Incorrect (may trigger the error):
    Kit[] kits = new Kit[]{new Crashlytics()};
    Fabric.with(this, kits);
    
  • Correct:
    Fabric.with(this, new Crashlytics());
    
    Even better, move this initialization to your Application class's onCreate() method instead of an Activity—this ensures Crashlytics is set up early and consistently across your entire app.

3. Clean & Rebuild Your Project

Cached build artifacts often cause class loading conflicts that lead to this error. Try these steps:

  • Run Build > Clean Project in Android Studio
  • Delete the build folder in your app module
  • Invalidate caches with File > Invalidate Caches... > Invalidate and Restart

4. Check for Duplicate Dependencies

You might have conflicting versions of Fabric/Crashlytics being pulled in by other libraries. Use the Gradle dependency tree to spot duplicates:

  • Run this command in your project root:
    ./gradlew app:dependencies
    
  • Look for multiple entries of crashlytics or fabric-sdk-android, then exclude the older/conflicting versions using Gradle's exclude rule.

5. Verify Fabric Plugin Setup

Make sure you have the Fabric plugin correctly configured:

  • In your project-level build.gradle:
    buildscript {
        repositories {
            maven { url 'https://maven.fabric.io/public' }
        }
        dependencies {
            classpath 'io.fabric.tools:gradle:1.+'
        }
    }
    
  • Apply the plugin in your module-level build.gradle:
    apply plugin: 'io.fabric'
    

Final Notes

Start with checking dependency versions and cleaning your project—those two fixes resolve 90% of these type mismatch issues with Crashlytics. If you're still stuck, double-check that you're not using any outdated Fabric/Crashlytics APIs that might have changed between versions.

内容的提问来源于stack exchange,提问作者Tarun Sharma

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 10:03:17