【问题标题】:ZipException: duplicate entry: com/google/android/gms/internal/measurement/zzabn.classZipException:重复条目:com/google/android/gms/internal/measurement/zzabn.class
【发布时间】:2018-10-14 15:11:43
【问题描述】:

com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com/google/android/gms/internal/measurement/zzabn.class

  • 生成签名的 apk 时显示此错误。

    这是我的 build.gradle

    apply plugin: 'com.android.application'
    
    android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'
    
    defaultConfig {
        applicationId "com.jhaider.livefootballmatchesofworldcup"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    
    packagingOptions {
        exclude 'META-INF/maven/com.squareup.okhttp3/okhttp/pom.properties'
        exclude 'META-INF/maven/com.squareup.okio/okio/pom.xml'
        exclude 'META-INF/maven/com.squareup.okhttp3/okhttp/pom.xml'
        exclude 'META-INF/maven/com.squareup.okio/okio/pom.properties'
    
    
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/maven/pom.properties'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
        exclude 'META-INF/gson/FieldAttributes.class'
        exclude '.readme'
    
    
    }
    
    dexOptions {
        javaMaxHeapSize "4g"
    }
    
    buildTypes {
        release {
            minifyEnabled false
            useProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    
    flavorDimensions "app-type"
    productFlavors {
        live1016 {
            applicationId "com.jhaider.livefootballmatchesofworldcup"
            minSdkVersion 16
            targetSdkVersion 25
            versionCode 1
            versionName "1.0"
            dimension "app-type"
        }
    
        videohighlights {
            applicationId "com.jhaider.livefootballmatchesofworldcup.videohighlights"
            minSdkVersion 16
            targetSdkVersion 25
            versionCode 1
            versionName "1.0"
            dimension "app-type"
        }
    }
    

    源集{ 直播1016 { 爪哇{ srcDir 'src/live1016/java' } 资源 { srcDir 'src/live1016/res' } }

        videohighlights {
            java {
                srcDir 'src/videohighlights/java'
            }
            resources {
                srcDir 'src/videohighlights/res'
            }
        }
    
    }
    

    }

    依赖{ 编译文件树(包括:['*.jar'],目录:'libs') testCompile 'junit:junit:4.12'

    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support:design:26.1.0'
    compile 'com.android.support:recyclerview-v7:26.1.0'
    compile 'com.google.firebase:firebase-invites:15.0.0'   
    compile 'com.google.firebase:firebase-messaging:15.0.0'
    compile 'com.google.firebase:firebase-ads:15.0.0'
    compile 'com.google.firebase:firebase-auth:15.0.0'
    
    compile 'com.google.firebase:firebase-core:15.0.0'
    

    编译'com.firebaseui:firebase-ui-auth:3.2.2'

    compile ('com.google.android.gms:play-services-auth:15.0.0'){
    
        force=true
    }
    compile ('com.google.android.gms:play-services-location:15.0.0'){
    
        force=true
    }
    compile project(':StartAppInApp-3.6.7')
    
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.squareup.okhttp3:okhttp:3.3.0'
    compile 'org.jsoup:jsoup:1.9.2'
    compile 'com.squareup.picasso:picasso:2.5.2'
    

    }

    // 在底部添加这个 应用插件:'com.google.gms.google-services'

【问题讨论】:

  • 显示build.gradle

标签: android


【解决方案1】:

我通过将 build.gradle 上的所有 firebase 依赖项从 15.0.0 升级到 15.0.2(如果可用)来解决。

转到https://firebase.google.com/docs/android/setup 获取最新版本,注意com.google.firebase:firebase-ads 的最新版本是15.0.0com.google.firebase:firebase-messaging 的最新版本是15.0.2

【讨论】:

  • 你救了我,你应该得到一个钟声!
  • 感谢好友您节省了我的时间!
  • 我也试过了,但现在我收到了这个错误:Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 15.0.0.
【解决方案2】:

删除 android studio 中的 assets 文件夹条目(不是从实际文件夹位置)。然后进行干净的构建。

【讨论】:

  • Delete assets folder entry in the android studio对不起先生,请阅读错误ZipException: duplicate entry
【解决方案3】:

与其降级或升级库,不如从不同版本中排除一个或多个相同的类。例如,如果您知道该类来自哪个模块,则可以使用:

compile('com.google.android.gms:play-services-auth:15.0.0') {
    exclude group: 'com.google.android.gms', module: 'module.of.dependecy,withconfllict'
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-12-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多