错误:任务执行失败:ransformException

时间:2015-12-19 09:27:19

标签: android-studio gradle duplicates google-play-services transform

我的gradle Dependency看起来像这样,

dependencies {
    compile files('libs/Shutterbug-1.0.0.jar')
    compile files('libs/VolleyWithJsonArrayRequest.jar')
    compile files('libs/android-async-http-1.4.3.jar')
    compile files('libs/geonames-1.1.12.jar')
    compile files('libs/jdom-1.0.jar')
    compile files('libs/kenburnsview-1.0.6.jar')
    compile files('libs/libGoogleAnalyticsServices.jar')
    compile files('libs/multiselectlistpreferencecompat.jar')
    compile files('libs/universal-image-loader-1.9.1.jar')    
    compile 'com.android.support:support-v4:23.1.1'
    compile 'com.google.android.gms:play-services:8.3.0'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.google.android.gms:play-services-ads:8.3.0'
    compile 'com.google.android.gms:play-services-identity:8.3.0'
    compile 'com.google.android.gms:play-services-gcm:8.3.0'
    compile 'com.google.android.gms:play-services-analytics:8.3.0'
}

但是当在android studio 1.5上运行应用程序时,我收到以下错误:

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/analytics/internal/Command$1.class

2 个答案:

答案 0 :(得分:10)

您很可能在libs/libGoogleAnalyticsServices.jarcom.google.android.gms:play-services-analytics:8.3.0依赖项之间存在重复。

如果您尝试使用最新的SDK(v4),请评论/删除libGoogleAnalyticsServices.jar行并重建。

如果您尝试使用v3 SDK,请注释/删除com.google.android.gms:play-services-analytics:8.3.0编译行并重建。

来源:Google Analytics https://developers.google.com/analytics/devguides/collection/android/v4/

的最新API文档

答案 1 :(得分:0)

很可能是一个重复的模块com.google.android.gms.analytics.internal

您可以做的是排除像这样的“内部”模块

compile('com.google.android.gms:play-services-analytics:8.3.0'){     排除群组:'com.google.android.gms',模块:'play-services-analytics-internal' }