Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run time gradle exception

I know this is a repeated question but I tried numerous code but couldn't solve the error

Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
android/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl.class

gradle file

apply plugin: 'com.android.application'

android {
  compileSdkVersion 23
  buildToolsVersion "23.0.3"

  defaultConfig {
      applicationId "com.cwish"
      minSdkVersion 16
      targetSdkVersion 23
      versionCode 1
      versionName "1.0"
      multiDexEnabled true
  }
  buildTypes {
      release {
          minifyEnabled false
          proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      }
  }
}
dependencies {

  compile fileTree(dir: 'libs', include: ['*.jar'])
  testCompile 'junit:junit:4.12'
  compile 'com.android.support:appcompat-v7:23.4.0'
  compile 'com.android.support:design:23.4.0'
  compile 'com.google.code.gson:gson:2.6.2'
  compile 'com.squareup.retrofit2:retrofit:2.1.0'
  compile 'com.squareup.retrofit2:converter-gson:2.1.0'
  compile 'com.android.support:recyclerview-v7:+'
  compile 'com.android.support:recyclerview-v7:23.1.0@aar'
  compile 'com.daimajia.numberprogressbar:library:1.2@aar'
  compile 'com.google.android.gms:play-services:8.3.0'
  compile 'com.koushikdutta.ion:ion:2.+'
}
like image 364
Er Kishor Maharjan Avatar asked Sep 27 '16 06:09

Er Kishor Maharjan


2 Answers

I guess this problem can be resolved by removing duplicate dependencies,before removing the duplicate dependencies, you should check your modules by this command:

gradlew -q dependencies yourProject:dependencies --configuration compile

refer to this answer:duplicate dependencies problem

Hope it can help you :)

like image 161
Zhang Xiang Avatar answered Oct 09 '22 23:10

Zhang Xiang


Looks like duplicate dependency problem, remove "compile 'com.android.support:recyclerview-v7:23.1.0@aar" and it'll be fine.

like image 24
Utsav Shrestha Avatar answered Oct 09 '22 22:10

Utsav Shrestha