So I am trying to set up ProGuard in Gradle for my Android Studio project and I get the following error when building the project:
Error:Execution failed for task ':app:proguardDebug'. java.io.IOException: Can't write [C:\Users\Rich\Desktop\WebProjects\AndroidStudioProjects\Roomie\app\build\intermediates\classes-proguard\debug\classes.jar] (Can't read C:\Users\Rich\Desktop\WebProjects\AndroidStudioProjects\Roomie\app\libs\bolts-android-1.1.4.jar(;;;;;;!META-INF/MANIFEST.MF)] (Duplicate zip entry [a/a.class == bolts-android-1.1.4.jar:bolts/AggregateException.class]))
Here is my proguard-rules.pro
-keep class butterknife.** { *; }
-dontwarn butterknife.internal.**
-keep class **$$ViewInjector { *; }
-dontwarn org.apache.http.annotation.**
-keepclasseswithmembernames class * {
@butterknife.* <fields>;
}
-keepclasseswithmembernames class * {
@butterknife.* <methods>;
}
For futur reference :
I stumbled upon the same problem and this post on SO helped me solved it.
Basically when you include libraries in your project, some of them contain common dependencies and this is why proguard fails with an IOException.
My problem was that I used Parse and Facebook SDKs and both of them imported bolts library as a dependency.
Simply adding some exclude directives when importing one of the conflicting SDKs solved the problem :
compile ('com.facebook.android:facebook-android-sdk:4.4.0') {
exclude module: 'bolts-android'
exclude module: 'support-v4'
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With