Good day. After updating google repository in AndroidStudio, I have an issue
> Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.transform.api.TransformException: java.util.zip.ZipException: duplicate entry:
> android/support/v7/cardview/BuildConfig.class
I'm trying to exclude group android.support from play-services, it did not help. When I started my project on another PC I have:
> Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.transform.api.TransformException: java.util.zip.ZipException: duplicate entry:
> android/support/annotation/AnimRes.class
my build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "ru.alexeyk.myevents"
minSdkVersion 14
targetSdkVersion 23
versionCode 16
versionName "1.121"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.github.nkzawa:socket.io-client:0.4.2') {
exclude group: 'org.json', module: 'json'
}
compile files('libs/sentry-1.1.4.jar')
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:support-annotations:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
compile 'com.github.machinarius:preferencefragment:0.1.2'
compile 'com.edmodo:cropper:1.0.1'
compile 'com.makeramen:roundedimageview:2.1.1'
compile 'org.ocpsoft.prettytime:prettytime:4.0.0.Final'
compile 'com.yandex.android:mobmetricalib:2.00@aar'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.google.android.gms:play-services-ads:8.1.0'
compile 'com.google.android.gms:play-services-analytics:8.1.0'
compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-gcm:8.1.0'
}
see if their duplicate jars or dependencies your adding remove it and your error will be gone: Eg: if you add android:supportv4 jar and also dependency you will get the error so remove the jar error will be gone
For me the issue was caused by
com.google.android.exoplayer
conflicting withcom.facebook.android:audience-network-sdk
.I fixed the problem by excluding the
exoplayer
library from theaudience-network-sdk
:Open your system command prompt/terminal -> Go to your Project folder path (root project folder ) -> Execute following command : command :-
gradlew clean
or./gradlew clean
Make sure that all your gradle dependencies are of same version. -> Example :- your appcompat and recyclerview dependencies should have same version.
-> Change your gradle dependencies to same version like :-
-> Rebuild your project and it will work fine.
There may be different reason for reported issue, few days back also face this issue 'duplicate jar', after upgrading studio. From all stackoverflow I tried all the suggestion but nothing worked for me.
But this is for sure some duplicate jar is there, For me it was present in one library libs folder as well as project libs folder. So I removed from project libs folder as it was not required here. So be careful while updating the studio, and try to understand all the gradle error.
AndroidStudio Menu:
Update old dependencies