0

I updated my app to use Firebase, it was working perfectly on my device. However its crashing on many of my users devices

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)

This is the crash.

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;
}
}

This is my build.gradle.

Any pointers here?

AL.
  • 36,815
  • 10
  • 142
  • 281
Faisal Memon
  • 774
  • 3
  • 12
  • 28
  • This issue has been addressed in many other questions such as this one: http://stackoverflow.com/q/37360126/4815718. Make sure you have followed all the [instructions for enabling Multidex](https://developer.android.com/studio/build/multidex.html#mdex-gradle) and that it is working. Also, why use version 9.0.2? The current version is 9.4.0. – Bob Snyder Sep 20 '16 at 16:14

2 Answers2

0

It looks like the problem is with google play services version of your users. You can try:

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;
    }
}

To verify google play services is available.

-1

You need to lower the firebase version you have, they have some problems with the new versions on some devices.

Siyual
  • 16,415
  • 8
  • 44
  • 58
Chief Madog
  • 1,738
  • 4
  • 28
  • 55