Search code examples
androidandroid-gradle-pluginandroid-appcompatandroiddesignsupport

Getting java.util.zip.ZipException: duplicate entry exception


I am trying to use design support library. Gradle dependencies are as follows

dependencies {
    compile 'com.android.support:appcompat-v7:23.2.1'
    compile 'com.android.support:design:23.2.1'
    compile 'com.android.support:support-v4:23.2.1'
    compile 'com.android.support:cardview-v7:23.2.1'
    compile 'com.android.support:multidex:1.0.1'
}

But when I trying to run app getting following error

FAILURE: Build failed with an exception.
  • What went wrong:

    Execution failed for task ':restoAdminApp:transformClassesWithJarMergingForDebug'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v7/recyclerview/BuildConfig.class

But when I use compile 'com.android.support:design:23.0.1' then it works fine. But getting another runtime exception as follow

FATAL EXCEPTION: main java.lang.NoClassDefFoundError: android.support.v7.internal.widget.TintManager

Can anyone help to resolve this issue?


Solution

  • Finally got the answer.Its transitive dependency problem.I have one module dependency which contain recyclerview-v7 .

    Design support library also contains the recyclerview-v7 dependency. So it gives java.util.zip.ZipException: duplicate entry: android/support/v7/recyclerview/BuildConfig.class error.

    I exclude the recyclerview dependency from Design support library as-

    compile ('com.android.support:design:23.2.0'){
        exclude group:'com.android.support', module:'recyclerview-v7'
    

    }

    and problem solved.