重复条目:android中的com / google / common / collect / package-info.class

时间:2016-11-28 05:46:25

标签: android

令人惊讶的是,在我将我的android studio 2.2.1升级到2.2.2之后,我遇到了重复输入的错误。我在谷歌搜索过,但没有类似的解决方案。

这是错误:

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(模块:应用):

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
}

如何解决这个问题。我搜索了很多,但没有发现类似的错误或解决方案

1 个答案:

答案 0 :(得分:2)

我猜你的volley:library已经过时了,这就是问题所在。使用最新版本。

第1步

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

第2步

降级版本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

最后清理 - 重建您的项目。

<强> FYI

降级并不是一种好的做法。如果您要使用buildToolsVersion

,则可以更改com.google.android.gms:play-services:10.0.0
compileSdkVersion 25
buildToolsVersion "25.0.1"