2

I am trying to create a chat app using Firebase, but when I run the code, I get this error:

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

My grade file:

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "24.0.2"
defaultConfig {
    applicationId "com.example.sebastian.chatapp"
    minSdkVersion 16
    targetSdkVersion 25
    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'
    }
}

}

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'
})
 compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.google.firebase:firebase-core:9.8.0'
compile 'com.google.firebase:firebase-invites:9.8.0'
compile 'com.firebaseui:firebase-ui:0.6.0'
compile 'com.google.firebase:firebase-auth:10.0.0'
compile 'com.android.support:support-v4:25.1.0'
testCompile 'junit:junit:4.12'


}



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

How can i resolve this issue?

AL.
  • 36,815
  • 10
  • 142
  • 281

3 Answers3

0

I had the same issue!, this a non-sense type problem & solution. move your

apply plugin: 'com.google.gms.google-services' to the top of the file.

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

......
Sadiq Md Asif
  • 882
  • 6
  • 18
0

Hey code contains duplicate dependency.

compile'com.android.support:appcompat-v7:25.1.0'
compile'com.google.firebase:firebase-core:10.0.1'
compile'com.android.support:design:23.4.0'
compile'com.google.firebase:firebase-core:9.8.0'
compile'com.google.firebase:firebase-invites:9.8.0'
compile'com.firebaseui:firebase-ui:0.6.0'
compile'com.google.firebase:firebase-auth:10.0.0'
compile'com.android.support:appcompat-v7:25.1.0'  //remove this
compile'com.android.support:design:25.1.0'   //remove this 
compile'com.android.support:support-v4:23.0.1' //remove this
testCompile'junit:junit:4.12'

Hope this help.Happy coding.

Sagar Gangawane
  • 1,985
  • 1
  • 12
  • 22
0

Firebase UI has transitive dependencies on the Firebase SDK libraries. The compatible versions are listed in a table in the Firebase UI documentation. To use the latest (10.0.1) version of the Firebase SDK, you must use version 1.0.1 of the Firebase UI library. You should also use consistent versions of the Firebase SDK libraries and Support libraries. Update your dependencies like this:

compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-invites:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.firebaseui:firebase-ui:1.0.1'
testCompile 'junit:junit:4.12'

Also, to use firebase-ui:1.0.1 the following change must be made to your project (top-level) build.gradle file:

allprojects {
    repositories {
        jcenter()
        mavenLocal()
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }
    }
}
Bob Snyder
  • 37,759
  • 6
  • 111
  • 158
  • Error:Failed to resolve: com.twitter.sdk.android:twitter:2.2.0 –  Jan 10 '17 at 06:09
  • Did you make the change to the repository list in the project build.gradle? – Bob Snyder Jan 10 '17 at 06:11
  • I updated my answer to add `mavenCentral()` to the repository list. See if that fixes it. – Bob Snyder Jan 10 '17 at 06:27
  • The addition of `maven { url 'https://maven.fabric.io/public' }` should fix the _Failed to resolve..._ error. [See here](https://github.com/firebase/FirebaseUI-Android/issues/392). Post your project build.gradle. – Bob Snyder Jan 10 '17 at 15:36