Android Studio - ProGuard IOException重复邮编条目 [英] Android Studio - ProGuard IOException Duplicate Zip Entry

查看:211
本文介绍了Android Studio - ProGuard IOException重复邮编条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我试图在我的Android Studio项目中为Gradle设置ProGuard,并且在构建项目时出现以下错误:


错误:任务':app:proguardDebug'的执行失败。
java.io.IOException:无法写入[C:\ Users \Rich\Desktop\WebProjects\AndroidStudioProjects\Roomie\app\build\intermediates\classes-proguard\\ \\debug\classes.jar](无法读取C:\ Users \Rich\Desktop\WebProjects\AndroidStudioProjects\Roomie\app\libs\bolts-android-1.1.4.jar (;;;;;;!META-INF / MANIFEST.MF)](重复的zip条目[a / a.class == bolts-android-1.1.4.jar:bolts / AggregateException.class]))


这是我的proguard-rules.pro

   - 维护刀类。** {*; } 
-dontwarn butterknife.internal。**
-keep class ** $$ ViewInjector {*; }

-dontwarn org.apache.http.annotation。**

-keepclasseswithmembernames class * {
@ butterknife。*< fields> ;;
}

-keepclasseswithmembernames class * {
@ butterknife。*< methods>;


解决方案

p>

我偶然发现了同样的问题,这个 的帖子帮助了我解决了它。



基本上,当您在项目中包含库时,其中一些包含常见的依赖关系,这就是为什么proguard会导致IOException异常。



我的问题是我使用了 Parse Facebook SDK,并且它们都导入了螺栓库作为依赖项。

  compile('')

在导入冲突的SDK之一时添加一些 exclude
排除模块:'bolt-android'
排除模块:'support-v4'
}


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'
}

这篇关于Android Studio - ProGuard IOException重复邮编条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆