1

I tried lots of solutions but they did not work for me I face this error when I try to generate app file:

Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/android/volley/Request$Priority.class

and here is my gradle :

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})

compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.volley:volley:1.0.0'  //volley http request library
compile 'com.nightonke:boommenu:2.1.0'            //navigation view
compile 'com.baoyz.pullrefreshlayout:library:1.2.0'            //refresh layout
compile 'com.github.medyo:fancybuttons:1.8.3'     //custom button
compile 'com.rengwuxian.materialedittext:library:2.1.4' //custom edittext
compile 'com.jaredrummler:material-spinner:1.1.0' //custom spinner
compile 'com.github.dmytrodanylyk.android-process-button:library:1.0.0' // progressbar button
compile 'com.alimuzaffar.lib:pinentryedittext:1.3.1'  //pin entry edit text
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.zarinpal:purchase:0.0.3-beta' 
compile 'com.android.support:multidex:1.0.1'

compile ('com.github.ganfra:material-spinner:1.1.1'){
    exclude group: 'com.nineoldandroids', module: 'library'
    exclude group: 'com.android.support', module: 'appcompat-v7'
}

testCompile 'junit:junit:4.12'

}

Soroosh
  • 543
  • 1
  • 4
  • 21

2 Answers2

1

I had the similar issue while making build on Jenkins, weirdly it was working fine on my local machine. After adding below exclude it worked both on local machine and Jenkins.

android{
   configurations {
   all*.exclude group: 'com.android.volley'
   }
}

I have added configurations block to my app's build.gradle inside android section.

If it matter's Compile SDK version is 22 and Build Tools version is 25.0.0

This worked like a charm.

1

I write this answer for every one who is using "zarinpal". you should just exclude volley library from "zarinpal library like this:

compile ('com.zarinpal:purchase:0.0.3-beta'){
        exclude group: 'com.mcxiaoke.volley', module: 'library'
    } //zarinpal api 
Soroosh
  • 543
  • 1
  • 4
  • 21