Eng.Abdullah
Eng.Abdullah

Reputation: 5

Getting the error “duplicate entry: com/google/android/gms/internal/zzaac$zza.class” when trying to build APK

Hi i am trying to build APK but iam Facing this problem in Android Studio.

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

Here Is My gradle

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "someId"
        minSdkVersion 19
        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 {

    testCompile 'junit:junit:4.12'
    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:cardview-v7:25.3.1'
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.google.firebase:firebase-core:10.2.4'
    compile 'com.google.firebase:firebase-messaging:10.2.4'
    compile 'com.firebase:firebase-jobdispatcher-with-gcm-dep:0.6.0'
}

And Here is My gradle (project)

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.1.1'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Upvotes: 0

Views: 111

Answers (3)

Sunil Kumar
Sunil Kumar

Reputation: 468

As that there is conflict in gcm play services different versions it leads to duplicate entires

Remove this from your build.gradle

 compile 'com.firebase:firebase-jobdispatcher-with-gcm-dep:0.6.0'

Add this

 compile 'com.firebase:firebase-jobdispatcher:0.8.5'

Upvotes: 1

Karanjeet Singh
Karanjeet Singh

Reputation: 94

It is working for me after trying for hours, this will invalidate caches and rebuilt the project on the next startup in android studio

File > invalidated caches/restart.

Upvotes: 0

Nouman Ch
Nouman Ch

Reputation: 4121

Try add this line in bottom of you build.gradle(app) file.

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

and

classpath 'com.google.gms:google-services:3.1.1'

in build.gradle(project)

Upvotes: 0

Related Questions