Error: "re-recording: android / support / v7 / appcompat / R $ anim.class"

Building the application causes 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 cleaned and built the project many times to no avail. It has the following in its gradle assembly:

 compile 'com.android.support:appcompat-v7:23.3.0' 

It also uses the library through its aar file. This library project also has a higher gradle in its construction.

Can anyone offer advice on how to fix this?

+6
source share
1 answer

Yup; Personally, the same problem a few days ago

The reason is, as you said, "This library project also has a gradle higher in its construction", the system will not be able to figure out which dependency (app-compile) com.android will take. support: appcompat-v7: 23.3.0 'or module project - compile' com.android.support:appcompat-v7:23.3.0 '), so hi says you have a duplicate entry

How to decide -

Step 1 - Just clean / create the project. go to assembly β†’ Clean / Create project.

Step 2 - In the terminal, execute in the root folder of the project. / gradlew clean *

Step 3: you must 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 correct answer is fooobar.com/questions/69251 / ...

And the answer that works for me is

I just remove 1 gradle application level dependency and just put it in the gradle module project level only, and also exclude support-v4 in which this animation class exists

  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' } 
+4
source

All Articles