Firebaseui-android: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/auth/api/signin/internal/zzf;

Created on 22 Nov 2016  路  4Comments  路  Source: firebase/FirebaseUI-Android

Step 1: Describe your environment

  • Android device: Nexus 4 Emulator
  • Android OS version: 5.1
  • Google Play Services version: 10.0.84
  • Firebase/Play Services SDK version: 10.0.0
  • FirebaseUI version: 1.0.0

Step 3: Describe the problem:

gradle build errors out with exception com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/auth/api/signin/internal/zzf;

Steps to reproduce:

  1. Create project with dependency as follows:
  compile rootProject.ext.libraries.firebaseCore
  compile rootProject.ext.libraries.firebaseCrash
  compile rootProject.ext.libraries.firebaseInvites
  compile rootProject.ext.libraries.firebaseMessaging
  compile rootProject.ext.libraries.firebaseAuthUI
  1. Build project

Observed Results:

com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/auth/api/signin/internal/zzf;

I suspect that this is due to having firebase version mismatch between my project and firebaseui. (9.8 vs 10.0). Does it mean I'm not able to use firebase 10.0 until firebase-ui is updated to firebase 10.0?

Most helpful comment

Yes you are correct, however, there is an easy way to get around this by overriding the gradle dependencies. I highly recommend going through all the dependencies of your libraries (the deps of your deps) and overriding them to ensure you always have the latest version whether the library updates them or not. Here is a snippet of my gradle file that compiles and runs with play services v10:

// Firebase UI
// Auth
compile 'com.firebaseui:firebase-ui-auth:1.0.0'
compile "com.google.firebase:firebase-auth:$playServicesVersion"
compile "com.google.android.gms:play-services-auth:$playServicesVersion"
compile("com.twitter.sdk.android:twitter:2.1.1@aar") { transitive = true }
compile 'com.facebook.android:facebook-android-sdk:4.17.0'
compile "com.android.support:cardview-v7:$supportLibVersion"
// Database
compile 'com.firebaseui:firebase-ui-database:1.0.0'
compile "com.google.firebase:firebase-database:$playServicesVersion"

You have to add firebase storage if you are using the full firebase-ui lib.

All 4 comments

Yes you are correct, however, there is an easy way to get around this by overriding the gradle dependencies. I highly recommend going through all the dependencies of your libraries (the deps of your deps) and overriding them to ensure you always have the latest version whether the library updates them or not. Here is a snippet of my gradle file that compiles and runs with play services v10:

// Firebase UI
// Auth
compile 'com.firebaseui:firebase-ui-auth:1.0.0'
compile "com.google.firebase:firebase-auth:$playServicesVersion"
compile "com.google.android.gms:play-services-auth:$playServicesVersion"
compile("com.twitter.sdk.android:twitter:2.1.1@aar") { transitive = true }
compile 'com.facebook.android:facebook-android-sdk:4.17.0'
compile "com.android.support:cardview-v7:$supportLibVersion"
// Database
compile 'com.firebaseui:firebase-ui-database:1.0.0'
compile "com.google.firebase:firebase-database:$playServicesVersion"

You have to add firebase storage if you are using the full firebase-ui lib.

@GaborPeto just to clarify a little, we are always "chasing" the latest version of the Firebase libraries. Because we want to develop FirebaseUI completely in the open (with the help of contributors like @SUPERCILEX) that means we generally lag by a few days. My goal is to get out a version of FirebaseUI that depends on Firebase/Play Services 10.0.0 ASAP.

@samtstern awesome!

Version 1.0.1 released which depends on Firebase 10.0.0, so this should be fixed.

Was this page helpful?
0 / 5 - 0 ratings