Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android :app:transformClassesWithJarMergingForDebug FAILED - ZipException: duplicate entry

Sorry if I asked a duplicate question, but I couldn't find a solution for this error. I surfed around stackoverflow,gradle site, android blogs, google search but there wasn't a working solution for several hours. I'm an android beginner so I not sure if I have missed something in other posts.

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
         compileSdkVersion 23
         buildToolsVersion "23.0.0"

defaultConfig {
    minSdkVersion 14
    targetSdkVersion 22
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile 'com.android.support:appcompat-v7:22.2.1.'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta1'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta1'
compile 'com.android.support:recyclerview-v7:22.2.1.'
compile 'com.android.support:cardview-v7:22.2.1.'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.pnikosis:materialish-progress:1.7'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile files('libs/android-support-v4-22.2.1.jar')
compile files('libs/applovin-sdk-6.0.1.jar')
compile files('libs/appodeal-1.13.1.jar')
compile files('libs/chartboost-5.2.0.jar')
compile files('libs/my-target-4.0.13.jar')
compile files('libs/unity-ads-1.4.7.jar')
}

The project was working fine until I add some libs from appodeal (those compile file lines). I have tried to build the project but gradle gave the errors.

:app:transformClassesWithJarMergingForDebug'.
com.android.build.transform.api.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v7/widget/RecyclerView$ItemDecoration.class

There are also 2 more error of the same exception about duplicate entry- not sure why I got them: android/support/v4/PrintKitKat.class and android/support/multidex/MultiDex$V14.class.

I tried to upgrade gradle, invalidate and restart to clear cache, omit dependencies then rebuild/clean project, find potential duplicate module to exclude, and search projects for those .class but I found no duplication.

like image 656
Phuong Dao Avatar asked Oct 06 '15 10:10

Phuong Dao


1 Answers

You can test putting this on root of directory in the Terminal

./gradlew clean
like image 190
mafiu Avatar answered Oct 18 '22 00:10

mafiu