ZipException:重复条目:com / google / android / gms / internal / measurement / zzabn.class

时间:2018-05-04 07:41:50

标签: android

  

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"
        }
    }
    

    sourceSets {         live1016 {             java {                 srcDir' src / live1016 / java'             }             资源{                 srcDir' src / live1016 / res'             }         }

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

    }

    依赖{     编译fileTree(包括:[' * .jar'],dir:' 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'

3 个答案:

答案 0 :(得分:10)

我解决了将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

答案 1 :(得分:0)

删除android studio中的资源文件夹条目(而不是从实际文件夹位置)。然后做一个干净的构建。

答案 2 :(得分:0)

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

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