带有改进2的java.util.zip.ZipException

时间:2016-11-16 15:51:35

标签: android retrofit2

我有

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.  
>com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: retrofit2/BuiltInConverters$BufferingResponseBodyConverter.class

我无法理解此错误的来源以及原因

当我从retrofit2添加gson转换器时,我知道了

我已经清理了项目

我的傻瓜

dependencies {
 compile fileTree(dir: 'libs', include: ['*.jar'])

androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
//compile files('libs/gson-2.7.jar')
// compile files('libs/okhttp-3.4.1.jar')
//compile files('libs/okio-1.11.0.jar')

compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.google.android.gms:play-services:9.2.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services-maps:9.2.1'
testCompile 'junit:junit:4.12'
}

2 个答案:

答案 0 :(得分:0)

//compile files('libs/gson-2.7.jar')
// compile files('libs/okhttp-3.4.1.jar')
//compile files('libs/okio-1.11.0.jar')

您对这些进行了评论,但这些仍在编译中

compile fileTree(dir: 'libs', include: ['*.jar'])

如果您不想编译它们,则需要实际删除jar文件。换句话说,确保你没有在libs文件夹中有任何改装相关的jar文件

答案 1 :(得分:-1)

删除libs中的jar文件retrofit2