Proguard throws an IOException for a double zip entry, despite only one entry existing

I am using the proguard gradle plugin inside intellij (not for android project), specifying my jars libraries as java home, input jars as jarname.jar and output bans as jarname.pro.jar. I have a proguard.txt file for configuration, and all but the Main parameter save the option. Proguard produces the following error:

java.io.IOException: Unable to write [/Users/user/src/name/build/libs/jarname.pro.jar] (Unable to read [/Users/user/src/name/hci/build/libs/jarname.jar ] (Duplicate zip entry [c / a / a / a.class == jarname.jar: com / google / gson / ExclusionStrategy.class]))

According to this source from proguard , I have duplicate entries in jarname.jar. Manual verification of jarname.jar does not show duplicate entries. Where should I look for this?

+6
source share
1 answer

Check out this solution / hack: fooobar.com/questions/1001274 / ...

Adapted for your error, add this to build.gradle:

import com.android.build.gradle.internal.pipeline.TransformTask def deleteDuplicateJniFiles() { def files = fileTree("/Users/user/src/name/hci/build/libs/") { include "**/jarname.jar" } files.each { it.delete() } } tasks.withType(TransformTask) { pkgTask -> pkgTask.doFirst { deleteDuplicateJniFiles() } } 

Note. This command does not actually remove these banks (your duplication error implies that they will be added back) - only the configuration / exception block will do this. I have no idea why they are included, since in my project they were not duplicated when checking gradle dependencies either .:

0
source

All Articles