【问题标题】:Duplicate jar file Error重复的jar文件错误
【发布时间】:2016-01-28 15:05:12
【问题描述】:

错误

FAILURE:构建失败并出现异常。

  • 出了什么问题: 任务 ':app:transformClassesWithJarMergingForDebug' 执行失败。

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

我添加了以下依赖项

dependencies {
//compile 'com.google.android.gms:play-services:+'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-location:8.3.0'
compile files('libs/twitter4j-core-4.0.2.jar')
compile project(':devsmartAndroid')
compile project(':FacebookSDK')
compile project(':libPhotoView')
compile files('libs/android-support-v4.jar')
compile project(':library')
//compile 'com.google.android.gms:play-services-gcm:7.5.0'
//compile 'com.google.android.gms:play-services-analytics:7.5.0'
compile files('libs/gcm.jar')
compile files('libs/libGoogleAnalyticsServices.jar')  }

【问题讨论】:

    标签: android visual-studio-2010 exception android-gradle-plugin


    【解决方案1】:

    :app:transformClassesWithJarMergingForDebug'。 com.android.build.api.transform.TransformException: java.util.zip.ZipException:重复条目: com/google/android/gms/analytics/internal/Command.class

    问题来了

     compile 'com.google.android.gms:play-services:8.4.0'
     compile 'com.google.android.gms:play-services-location:8.3.0'
    

    你应该打电话给 终于

    compile 'com.google.android.gms:play-services:8.4.0'
    

    编辑

    我假设libGoogleAnalyticsServices.jar 创建重复条目

    所以你可以只评论这个jar

    编译文件('libs/libGoogleAnalyticsServices.jar')

    【讨论】:

    • 请给我反馈。
    • 你可以分享你的答案。
    • 如果我得到了,我不会得到正确的解决方案
    • 如果我评论 libGoogleAnalyticsServices.jar 这段代码,它会得到 EasyTracker class not found 错误
    【解决方案2】:

    在您的 Gradle 文件中有两个依赖项

    compile 'com.google.android.gms:play-services:8.4.0'
    

    编译 'com.google.android.gms:play-services-location:8.3.0'

    不要同时使用两者,只使用一个

    compile 'com.google.android.gms:play-services:8.4.0'
    

    因为播放服务包与所有播放服务合并。否则分别添加每个例如GCM,GA

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-15
      • 2017-08-06
      • 1970-01-01
      • 2021-10-14
      • 1970-01-01
      • 2012-01-05
      • 2014-10-22
      • 2016-11-07
      相关资源
      最近更新 更多