首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ZipExcepton:复制条目:com/google/android/gms//zzpi.class

ZipExcepton:复制条目:com/google/android/gms//zzpi.class
EN

Stack Overflow用户
提问于 2016-08-22 17:23:01
回答 1查看 1.3K关注 0票数 0

每当我试图运行我的项目时,我都会遇到这个问题。

我得到了这个错误:

代码语言:javascript
复制
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzpi.class

下面是我的构建脚本:

代码语言:javascript
复制
    buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        // The Fabric Gradle plugin uses an open ended version to react
        // quickly to Android tooling updates
        classpath 'io.fabric.tools:gradle:1.15.2'
    }
}
apply plugin: 'com.android.application'
//Put Fabric plugin after Android plugin

repositories {
    maven { url 'https://maven.fabric.io/public' }
}


dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile files('libs/commons-collections4-4.0.jar')
    compile files('libs/YouTubeAndroidPlayerApi.jar')
    compile files('libs/graphview-3.1.jar')
    testCompile 'junit:junit:4.12'
    compile project(':progresslibrary')
    compile files('libs/gson-2.6.2.jar')
    compile('com.crashlytics.sdk.android:crashlytics:2.6.2@aar') {
        transitive = true;
    }
    apt 'com.github.hotchemi:permissionsdispatcher-processor:2.1.2'
    apt 'com.github.hotchemi:permissionsdispatcher-processor:2.1.2'



    compile 'com.android.support:multidex:1.0.0'
    compile 'com.hrules:charter:1.4.0'
    compile 'com.github.hotchemi:permissionsdispatcher:2.1.2'
    //noinspection GradleCompatible
    compile 'com.google.android.gms:play-services-analytics:8.4.0'
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.15'
    compile 'com.android.support:multidex:1.0.0'
    compile 'com.hrules:charter:1.4.0'
    compile 'com.google.android.gms:play-services-analytics:8.4.0'
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.15'
    compile 'com.github.hotchemi:permissionsdispatcher:2.1.2'
    compile 'com.amazonaws:aws-android-sdk-core:2.+'
    compile 'com.amazonaws:aws-android-sdk-s3:2.+'
    compile 'eu.the4thfloor.volley:com.android.volley:2015.05.28'
    compile 'com.facebook.android:facebook-android-sdk:4.0.0'
    compile 'com.snappydb:snappydb-lib:0.5.2'
    compile 'com.google.android.gms:play-services-auth:9.4.0'
    compile 'com.google.android.gms:play-services-plus:8.4.0'
    compile 'com.google.android.gms:play-services-gcm:9.4.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.google.android.gms:play-services-location:8.4.0'
    compile 'com.wdullaer:materialdatetimepicker:2.2.0'
    compile 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
    compile 'com.shamanland:fab:0.0.8'
    compile 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.3.0'
    compile 'com.android.support:design:23.2.0'
    compile 'com.android.support:support-v4:23.2.0'
    compile 'com.android.support:recyclerview-v7:23.2.0'
    compile 'com.android.support:cardview-v7:23.2.0'
    compile 'org.jsoup:jsoup:1.9.1'
    compile 'com.flurry.android:analytics:6.2.0'
    compile 'com.google.android.gms:play-services-fitness:8.4.0'
    compile 'com.google.android.gms:play-services-appindexing:8.4.0'
    compile 'com.github.danielemaddaluno.androidupdatechecker:library:1.0.2'
    compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
}

android {
    packagingOptions {
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/LICENSE.txt'
    }
}
apply plugin: 'build-announcements'

请告诉我我的构建脚本有什么问题

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-08-22 18:14:34

快速地看一下,我可以告诉你,这个问题存在于Google服务中。我将猜测,所有这些都需要相同的版本(按这里的相同版本分组)。

代码语言:javascript
复制
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-plus:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-fitness:8.4.0'
compile 'com.google.android.gms:play-services-appindexing:8.4.0'

compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'

为了有效地做到这一点,您可以在Gradle文件中定义一个ext块,以保持版本号保持一致。

附加注意事项:这行compile fileTree(include: ['*.jar'], dir: 'libs').它说编译libs/目录中的所有JAR文件,因此,这些行是没有意义的,您可以在尝试确定错误发生的位置时删除它们。

代码语言:javascript
复制
compile files('libs/commons-collections4-4.0.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile files('libs/graphview-3.1.jar')
compile files('libs/gson-2.6.2.jar')

样本build.gradle

代码语言:javascript
复制
ext {
    // Variables to keep libraries consistent
    supportLibrary = "23.2.0"
    googlePlayServicesVersion = '9.4.0'

    // Support Libraries dependencies
    supportDependencies = [
            design           :         "com.android.support:design:${supportLibrary}",
            recyclerView     :         "com.android.support:recyclerview-v7:${supportLibrary}",
            cardView         :         "com.android.support:cardview-v7:${supportLibrary}",
            appCompatV7      :         "com.android.support:appcompat-v7:${supportLibrary}"
    ]

    googlePlayServicesDepends = [
            analytics   : "com.google.android.gms:play-services-analytics:${googlePlayServicesVersion}"
            plus        : "com.google.android.gms:play-services-plus:${googlePlayServicesVersion}"
            location    : "com.google.android.gms:play-services-location:${googlePlayServicesVersion}"
            fitness     : "com.google.android.gms:play-services-fitness:${googlePlayServicesVersion}"
            appindexing : "com.google.android.gms:play-services-appindexing:${googlePlayServicesVersion}"
            auth        : "com.google.android.gms:play-services-auth:${googlePlayServicesVersion}"
            gcm         : "com.google.android.gms:play-services-gcm:${googlePlayServicesVersion}"
    ]

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    // compile supportDependencies.appCompatV7
    // compile supportDependencies.recyclerView

    // recommended - includes those above
    compile supportDependencies.design

    // extras
    compile supportDependencies.cardView

    // The correct Volley library
    compile 'com.android.volley:volley:1.0.0'

    compile 'com.squareup.picasso:picasso:2.5.2'
    compile "com.google.code.gson:gson:2.6.2"

    // Google Play Services
    compile googlePlayServicesDepends.location
    // TODO: Add others

}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39085327

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档