java.lang.NoClassDefFoundError:在Play商店更新到Firebase后的com.google.firebase.FirebaseOptions

时间:2016-09-20 14:43:45

标签: android firebase firebase-realtime-database

我更新了我的应用以使用Firebase,它在我的设备上完美运行。然而,它崩溃了我的许多用户设备

java.lang.NoClassDefFoundError: com.google.firebase.FirebaseOptions
at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1058)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5021)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4633)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4573)
at android.app.ActivityThread.access$1400(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5319)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)

这是崩溃。

dependencies {
compile 'com.android.support:multidex:1.0.0'
 compile 'com.splunk.mint:mint:4.0'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:support-v4:24.0.0'
compile 'com.google.android.gms:play-services:9.0.2'
compile 'com.google.firebase:firebase-core:9.0.2'
compile "com.mixpanel.android:mixpanel-android:4.+"
compile('com.crashlytics.sdk.android:crashlytics:2.6.3@aar') {
    transitive = true;
}
}

这是我的build.gradle。

这里有指针吗?

2 个答案:

答案 0 :(得分:0)

看起来问题出在您的用户的Google Play服务版本上。你可以尝试:

private boolean checkGooglePlayServices() {
    final int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
    if (status != ConnectionResult.SUCCESS) {
        Log.e(TAG, GooglePlayServicesUtil.getErrorString(status));

        // ask user to update google play services.
        Dialog dialog = GooglePlayServicesUtil.getErrorDialog(status, this, 1);
        dialog.show();
        return false;
    } else {
        Log.i(TAG, GooglePlayServicesUtil.getErrorString(status));
        // google play services is updated. 
        //your code goes here...
        return true;
    }
}

验证Google Play服务是否可用。

答案 1 :(得分:-1)

您需要降低您拥有的firebase版本,它们在某些设备上的新版本存在一些问题。