AAA
AAA

Reputation: 505

duplicate entry: com/google/common/collect/package-info.class in android

surprisingly i am facing a error of duplicate entry after i upate my android studio 2.2.1 to 2.2.2. i have searched in google but there is no similar solution.

this is error:

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/common/collect/package-info.class

build.gradle(module:app):

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    defaultConfig {
        applicationId "com.systechdigital.webadeal"
        minSdkVersion 17
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        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'
    }

    configurations {
        compile.exclude group: "org.apache.httpcomponents", module: "httpclient"
    }

}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:24.0.0-beta1'
    compile 'com.android.support:design:24.0.0-beta1'
    compile 'com.google.android.gms:play-services-auth:10.0.0'
    compile 'com.google.android.gms:play-services:10.0.0'
    compile 'com.mcxiaoke.volley:library-aar:1.0.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile 'com.github.delight-im:Android-AdvancedWebView:v3.0.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.google.gdata:core:1.47.1'
    compile 'com.survivingwithandroid:weatherlib_okhttpclient:1.6.0'
    compile 'com.google.api-client:google-api-client:1.20.0'
}
apply plugin: 'com.google.gms.google-services'

build.gradle:

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'
        classpath 'com.google.gms:google-services:3.0.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

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

how to solve this. i googled a lot but no similar error or solution i found

Upvotes: 2

Views: 590

Answers (1)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75788

I guess your volley:library is old ,That's why problem .Use latest version .

Step 1

compile 'com.mcxiaoke.volley:library:1.0.19'

Step 2

Downgrade version com.google.android.gms:play

 compile 'com.google.android.gms:play-services:9.2.1' //9.6.1
 compile 'com.google.android.gms:play-services-auth:9.2.1' //9.6.1

Finally Clean-Rebuild Your Project .

FYI

Downgrade is not good practice . You can change your buildToolsVersion if you want to use com.google.android.gms:play-services:10.0.0

compileSdkVersion 25
buildToolsVersion "25.0.1"

Upvotes: 2

Related Questions