【问题标题】:duplicate entry: com/google/android/gms/measurement/AppMeasurementContentProvider.class重复条目:com/google/android/gms/measurement/AppMeasurementContentProvider.class
【发布时间】:2016-07-27 15:08:16
【问题描述】:

在我更新项目的 firebase SDK 后,此错误开始出现。如果我尝试正常构建项目,它的工作正常。但是每当尝试构建签名的 APK 时,都会出现以下错误。

错误:任务执行失败 ':app:transformClassesWithJarMergingForProductionRelease'.

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

这是我的项目依赖项。不确定重复发生在哪里。

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile(name: 'google-maps-sdk-m4b', ext: 'aar')
    compile('io.intercom.android:intercom-sdk:1.+@aar') { transitive = true }
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'

    compile 'com.makeramen:roundedimageview:2.2.1'
    compile 'com.google.code.gson:gson:2.4'
    compile 'com.squareup.okhttp:okhttp:2.4.0'
    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'de.greenrobot:eventbus:2.4.0'
    compile 'com.mixpanel.android:mixpanel-android:4.6.4'
    compile 'com.google.maps.android:android-maps-utils:0.4.1'
    compile 'com.stripe:stripe-android:+'
    compile 'com.github.jkwiecien:EasyImage:1.2.1'
    compile 'com.github.dbachelder:CreditCardEntry:1.4.7'
    compile 'com.appsflyer:af-android-sdk:4.3.5@aar'
    compile 'com.bugsnag:bugsnag-android:+'
    compile 'com.facebook.android:facebook-android-sdk:4.+'
    compile 'com.google.android.gms:play-services-location:9.0.2'
    compile 'com.google.firebase:firebase-database:9.0.2'
    compile 'com.google.firebase:firebase-auth:9.0.2'
    compile 'com.google.firebase:firebase-messaging:9.0.2'
    compile 'cn.aigestudio.wheelpicker:WheelPicker:1.1.0' 
} 

apply plugin: 'com.google.gms.google-services'

【问题讨论】:

  • 您遇到的这种错误是因为其他具有相同类的jar依赖。还要确保您没有将支持 jar 添加为 gradle 和 jar 依赖项。我无法尝试,但请确保您按照此处的步骤添加Mobile SDK for work。另一种方法是尝试单独构建依赖项,以了解它的哪一部分导致了此错误。

标签: java android google-maps google-play-services


【解决方案1】:

我已经通过改变解决了

classpath 'com.google.gms:google-services:2.0.0-alpha2'

classpath 'com.google.gms:google-services:3.0.0'

在项目级 gradle 文件中

【讨论】:

    【解决方案2】:

    所以我想出了解决问题的办法。添加exclude group: 'com.google.android.gms' 解决了这个问题:

    compile('io.intercom.android:intercom-sdk:1.+@aar') {
        transitive = true
        exclude group: 'com.google.android.gms'
    }
    

    【讨论】:

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