java.lang.ClassNotFoundException: 未找到 class "io.fabric.sdk.android.services.common.FirebaseInfo"

java.lang.ClassNotFoundException: Didn't find class "io.fabric.sdk.android.services.common.FirebaseInfo"

我正在尝试将 Fabric Crashlytics 从 2.6.8 更新到 2.7.1 但是我在这次更新中遇到了以下崩溃:

10-24 11:38:32.917 11352-11352/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                   Process: com.xxx.yyy, PID: 11352
                                                   java.lang.NoClassDefFoundError: Failed resolution of: Lio/fabric/sdk/android/services/common/FirebaseInfo;
                                                       at com.crashlytics.android.CrashlyticsInitProvider.onCreate(CrashlyticsInitProvider.java:22)
                                                       at android.content.ContentProvider.attachInfo(ContentProvider.java:1919)
                                                       at android.content.ContentProvider.attachInfo(ContentProvider.java:1894)
                                                       at android.app.ActivityThread.installProvider(ActivityThread.java:6285)
                                                       at android.app.ActivityThread.installContentProviders(ActivityThread.java:5851)
                                                       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5772)
                                                       at android.app.ActivityThread.-wrap1(Unknown Source:0)
                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
                                                       at android.os.Handler.dispatchMessage(Handler.java:105)
                                                       at android.os.Looper.loop(Looper.java:164)
                                                       at android.app.ActivityThread.main(ActivityThread.java:6541)
                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
                                                    Caused by: java.lang.ClassNotFoundException: Didn't find class "io.fabric.sdk.android.services.common.FirebaseInfo" on path: DexPathList[[zip file "/data/app/com.ezcommerceapp.swiftshopper-_VJvHhv49x3edMWdRjpNxA==/base.apk"],nativeLibraryDirectories=[/data/app/com.xxx.sbd_VJvHhv49x3edMWdRjpNxA==/lib/x86, /data/app/com.xxx.sbd_VJvHhv49x3edMWdRjpNxA==/base.apk!/lib/x86, /system/lib, /system/vendor/lib]]
                                                       at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
                                                       at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
                                                       at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                                                       at com.crashlytics.android.CrashlyticsInitProvider.onCreate(CrashlyticsInitProvider.java:22) 
                                                       at android.content.ContentProvider.attachInfo(ContentProvider.java:1919) 
                                                       at android.content.ContentProvider.attachInfo(ContentProvider.java:1894) 
                                                       at android.app.ActivityThread.installProvider(ActivityThread.java:6285) 
                                                       at android.app.ActivityThread.installContentProviders(ActivityThread.java:5851) 
                                                       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5772) 
                                                       at android.app.ActivityThread.-wrap1(Unknown Source:0) 
                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661) 
                                                       at android.os.Handler.dispatchMessage(Handler.java:105) 
                                                       at android.os.Looper.loop(Looper.java:164) 
                                                       at android.app.ActivityThread.main(ActivityThread.java:6541) 
                                                       at java.lang.reflect.Method.invoke(Native Method) 
                                                       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 

在 build.gradle(应用程序)中:

...
compile('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
    transitive = true
    exclude group: 'com.android.support', module: 'support-annotations'
    exclude group: 'io.fabric.sdk.android', module: 'fabric'
}
...

谁能帮我解决这个问题?

好的..删除排除行对我有用:

compile('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
    transitive = true
    exclude group: 'com.android.support', module: 'support-annotations'
}

请检查此配置。这个我用过

在应用程序中 Gradle

    apply plugin: 'io.fabric'

    compile('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
        transitive = true;
    }
    compile('com.crashlytics.sdk.android:answers:1.4.1@aar') {
        transitive = true;
    }
    compile('io.fabric.sdk.android:fabric:1.4.1@aar') {
        transitive = true;
    }

项目Gradle

buildscript {
repositories {
        jcenter()
        mavenLocal()
        maven { url 'https://maven.fabric.io/public' }

    }
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
  }
}

它也适用于我。你可以试试这个

我通过将 Multidex.install() 移动到 attachBaseContext(Context base) 来解决这个问题。我在 Application

onCreate() 中找到了它
@Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
}