简体   繁体   English

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

[英]java.util.zip.ZipException with retrofit 2

I'm having 我有

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

I can't understand from where this error come and why 我不明白这个错误来自哪里以及为什么

Appaered whe i added gson converter from retrofit2 我在Retrofit2中添加了GSON转换器

I already clean the project 我已经清理了这个项目

my gradle 我的摇篮

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'
}
//compile files('libs/gson-2.7.jar')
// compile files('libs/okhttp-3.4.1.jar')
//compile files('libs/okio-1.11.0.jar')

You commented these, but those are still being compiled 您评论了这些,但这些仍在编译中

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

You need to actually remove the jar files if you do not want to compile them. 如果不想编译jar文件,则实际上需要删除它们。 In other words, make sure you don't have any retrofit related jar files in the libs folder 换句话说,请确保您在libs文件夹中没有任何与改造相关的jar文件

删除libs中的jar文件retrofit2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM