Building an app generates the following error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v7/appcompat/R$anim.class
I have cleaned and built the project many times to no avail. It has the following in its gradle build:
compile 'com.android.support:appcompat-v7:23.3.0'
It also uses a library via its aar file. That library project also has the above in its gradle build.
Could anyone offer a tip on how to resolve this?
Yup , Face same problem few days ago
Reason - as you told "That library project also has the above in its gradle build" actually system wont able to understand which dependency hi will take (app's - compile 'com.android.support:appcompat-v7:23.3.0' or module project's - compile 'com.android.support:appcompat-v7:23.3.0' ) so that hi says you have duplicate entry
How To Resolve -
Step 1 - Just Clean/Build Project. go to Build -> Clean/Build Project.
Step 2 - In terminal execute in root project folder ./gradlew clean*
Step 3- you have to exclude your group from one dependency
compile('com.android.support:design:23.2.1') {
exclude group: 'com.android.support', module: 'support-v7'
}
Step 4 - Check Out This Awsome Answer https://stackoverflow.com/a/19022328/4741746
And Answer That Work for me is -
I just remove 1 dependency from apps level gradle and just put only in module project level gradle and also exclude support-v4 in which that anim class exist
compile 'com.android.support:appcompat-v7:23.2.1'
compile('com.android.support:design:23.2.1') {
exclude group: 'com.android.support', module: 'support-v4'
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With