简体   繁体   中英

Error when trying to build APK for app

I get this error when I try to build my app in Android Studio

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: retrofit2/BuiltInConverters$BufferingResponseBodyConverter.class

Here are my dependencies:

compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.google.firebase:firebase-core:9.0.2'
compile 'com.google.firebase:firebase-analytics:9.0.2'
compile 'com.google.firebase:firebase-config:9.0.2'
compile 'com.google.firebase:firebase-auth:9.0.2'
compile 'com.google.android.gms:play-services:9.0.2'
compile 'com.google.android.gms:play-services-appindexing:9.0.2'
compile 'com.google.firebase:firebase-database:9.0.2'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.google.android.gms:play-services-maps:9.0.2'
compile 'com.android.support.constraint:constraint-layout:+'
compile 'com.android.support:multidex:1.0.1'

It seems like some jar files are not compiled properly.

Try to clean or Rebuild the project

If it doesn't help than remove the jar file and try to add it again

I am sure it will help

What you showed looks good.

According to the error, you have duplicate converter class.

Remove any retrofit jars in you libs folder, then run gradle build again

Remove the gson library u have added separately. Only the one with the retrofit is required.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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