1

I am building my android project with following build.gradle

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.handyman.user"
        minSdkVersion 14
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/notice.txt'
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

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.1.1'
    compile 'com.android.support:cardview-v7:25.1.1'
    compile 'com.android.support:design:25.1.1'
    compile 'com.android.support:percent:25.1.1'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    testCompile 'junit:junit:4.12'
    compile 'com.github.ronaldsmartin:Material-ViewPagerIndicator:1.0.2'
    compile 'com.github.florent37:singledateandtimepicker:1.0.8'

    // retrofit essentials
    compile 'com.squareup.retrofit2:retrofit:2.0.2'
    compile 'com.squareup.retrofit2:converter-gson:2.0.2'

    // retrofit logging
    compile 'com.facebook.stetho:stetho:1.3.1'
    compile 'com.facebook.stetho:stetho-okhttp3:1.3.1'
    compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'

    compile 'uk.co.chrisjenx:calligraphy:2.2.0'

    compile 'com.google.firebase:firebase-messaging:10.0.1'

    compile 'com.android.support:multidex:1.0.1'
}

but my build is failing which says

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

In my app multidex is enabled. I tried cleaning and rebuilding project multiple times without any result and tried changing firebase dependency's version to different one's but that was also useless.

darthvish
  • 61
  • 5

2 Answers2

0

Try adding this to build.gradle.

android{


    configurations {
        all*.exclude group: 'com.android.support', module: 'support-v4'
        all*.exclude group: 'com.android.support', module: 'support-annotations'
    }

}

Credits: java.util.zip.ZipException: duplicate entry during packageAllDebugClassesForMultiDex

Community
  • 1
  • 1
Shridhar R Kulkarni
  • 6,653
  • 3
  • 37
  • 57
  • you should give credit to this answer...http://stackoverflow.com/questions/26966843/java-util-zip-zipexception-duplicate-entry-during-packagealldebugclassesformult – rafsanahmad007 Mar 06 '17 at 09:27
0

I solved this problem by putting this lineapply plugin: 'com.google.gms.google-services' at the bottom of build.gradle rather than below apply plugin: 'com.android.application'

darthvish
  • 61
  • 5