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

标签 android

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

这是错误:

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'

构建.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
}

如何解决这个问题。我用谷歌搜索了很多,但没有找到类似的错误或解决方案

最佳答案

我猜你的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

最后清理重建您的项目。

仅供引用

降级不是一个好的做法。如果您想使用 com.google.android.gms:play-services:10.0.0

,您可以更改 buildToolsVersion
compileSdkVersion 25
buildToolsVersion "25.0.1"

关于android - android 中的重复条目 : com/google/common/collect/package-info. 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40837857/

相关文章:

android - 手机传感器

android - NFC和NDEF有什么关系

php - 通过在 php 中给定一个特定的 id 来删除多个表

java - 未打开顶部的 Activity

java - Android 无法在 main-dex 文件中容纳请求的类

java - 如果其他应用程序在设备上崩溃,Android 应用程序会监听

Android SQLite 更新在 AsyncTask 中无法在后台运行

android - 添加值后增加共享首选项键

android - 使用 websocket 的 Expo v27/v28 Android 应用程序崩溃

java - Android 上的 YouTube 客户端出现 java.lang.NullPointerException