重复的jar文件错误

时间:2016-01-27 13:01:22

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

错误

失败:构建因异常而失败。

  • 出了什么问题: 任务':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')  }

2 个答案:

答案 0 :(得分:2)

  

:应用程序:transformClassesWithJarMergingForDebug”。   com.android.build.api.transform.TransformException:   java.util.zip.ZipException:重复条目:   COM /谷歌/机器人/克/分析/内部/ 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')

答案 1 :(得分:0)

"\(\d{4}\)\.([^.]*)"g \( matches the character ( literally \d{4} match a digit [0-9] Quantifier: {4} Exactly 4 times \) matches the character ) literally \. matches the character . literally 1st Capturing group ([^.]*) [^.]* match a single character not present in the list below Quantifier: * Between zero and unlimited times, as many times as possible, giving back as needed [greedy] . the literal character . g modifier: global. All matches (don't return on first match) 文件中有两个依赖项

Gradle

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

而不是同时使用两者

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

因为播放服务包与所有播放服务合并在一起。否则每个单独添加,如compile 'com.google.android.gms:play-services:8.4.0'