Badr Bujbara
Badr Bujbara

Reputation: 8691

Duplicate Entry Gradle Error Using Firebase UI Dependancy

I'm using Firebase UI in my app but having difficulty building the app after adding the Firebase UI dependency. It complains about 'com/google/android/gms/auth/api/signin/internal/zzf.class' being duplicated, so I added an exclude statement for it but without success. Here is how my build.gradle look like:

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.0"
    defaultConfig {
        applicationId "appfactory.app.chatapp"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'com/google/android/gms/auth/api/signin/internal/zzf.class'
    } 
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    testCompile 'junit:junit:4.12'

    compile 'com.android.support:design:24.2.0'
    compile 'com.android.support:appcompat-v7:24.2.0'

    // Displaying images
    compile 'com.github.bumptech.glide:glide:3.6.1'

    compile 'com.google.firebase:firebase-database:10.0.0'
    compile 'com.google.firebase:firebase-auth:10.0.0'
    // FirebaseUI Auth only
    compile 'com.firebaseui:firebase-ui-auth:0.6.2'

}

apply plugin: 'com.google.gms.google-services'

And here is the error I get

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class

Upvotes: 0

Views: 340

Answers (1)

Sunil Sunny
Sunil Sunny

Reputation: 3994

From the readme file of FirebaseUI for Android — UI Bindings for Firebase

Each version of FirebaseUI has dependency on a fixed version of these libraries, defined as the variable firebase_version in common/constants.gradle

In your case you are using 0.6.2 and the corresponding com.google.firebase:firebase version is 9.8.0

So changing

compile 'com.google.firebase:firebase-database:10.0.0'
compile 'com.google.firebase:firebase-auth:10.0.0'

to

compile 'com.google.firebase:firebase-database:9.8.0'
compile 'com.google.firebase:firebase-auth:9.8.0'

Should fix the problem.

Upvotes: 2

Related Questions