1

I have been developing and working on my App, I then decided to build the APK I then got duplicate file error specifically talking about firebase zzc.class? which I could not find. I have seen duplicate file error before and sorted it out but this Firebase error has really slowed down my work because I have seen no specific answer to my issue.

Below are my dependencies

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 
{
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.+'
compile 'com.android.support:support-v4:25.+'
compile 'com.android.support:design:25.+'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.google.firebase:firebase-storage:10.0.1'
compile 'com.firebaseui:firebase-ui:2.0.1'
compile 'org.apache.pdfbox:pdfbox:2.0.0'
compile 'net.igenius:customcheckbox:1.3'
compile 'com.roger.catloadinglibrary:catloadinglibrary:1.0.1'
testCompile 'junit:junit:4.12'
}

Then the error:

enter image description here

enter image description here

Lemuel Ogbunude
  • 184
  • 3
  • 16

3 Answers3

1

You are using different versions of the same libraries:

compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-storage:10.0.1'
compile 'com.firebaseui:firebase-ui:2.0.1'

As you can read here there is a dependency between firebaseui and firebase libraries:

FirebaseUI Version  Firebase/Play Services Version
2.3.0               11.0.4
2.2.0               11.0.4
2.1.1               11.0.2
2.0.1               11.0.1

Use the same version to avoid these issue.

Also there is no reason to use the old:

compile 'com.firebase:firebase-client-android:x.x.x'

Check the migration guide and use:

compile "com.google.firebase:firebase-database:X.X.X"

Keep in mind that the latest version requires the google maven repo:

allprojects {
    // ...
    dependencies {
        // ...
        maven {
            url "https://maven.google.com" // Google's Maven repository
        } 
    }
}
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
0

This is happening because you have a duplicate in your build.gradle file. To solve this, you need to remove the following line of code:

compile 'com.firebase:firebase-client-android:2.3.1'

You cannot mix the old version of dependency with the new one.

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193
  • No it does not it still gives the same error, I was trying to play with the dependencies a little to see if it will go but the error just kept on changing to worse ones. So for now the error is the same after removing firebase-client :( – Lemuel Ogbunude Sep 11 '17 at 13:31
  • Update all your dependencies to `11.0.4` version kepping that line commented. Any changes? – Alex Mamo Sep 11 '17 at 13:33
0

Make sure to update firebase version to latest available version in your build(app) configuration exactly mentioned in the firebase documentation.

[https://firebase.google.com/docs/android/setup/]

If you are using play services make sure that the version of firebase library should be exactly same as of play services version.

compile 'com.google.android.gms:play-services:11.2.0'
compile 'com.google.firebase:firebase-core:11.2.0'
compile 'com.google.firebase:firebase-messaging:11.2.0'

If there is a library conflict then add gradle as:

 defaultConfig {
    multiDexEnabled true
}

and in your baseapplication

@Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
}
garry
  • 419
  • 5
  • 10