我正在尝试在android studio中为我的发布版本配置proguard,但我收到错误和警告如下:
错误:任务执行失败':myAccount_S:proguardRelease'。
java.io.IOException:无法写[C:\ Users \ mgi \ AndroidStudioProjects \ MyProjects \ myAccount_S \ build \ intermediates \ classes-proguard \ release \ classes.jar](无法读取[C:\用户\ MGI \ AndroidStudioProjects \ MyAccountProjects \ myAccount_S \建立\ \中间体爆炸-AAR \ MyAccountProjects \在MyLibrary \不明\库\ PushTracker-1.3.0-tracfone.jar(;;;;;;!META-INF / MANIFEST.MF )](重复的zip条目[PushTracker-1.3.0-tracfone.jar:com / mgage / push / tracker / PushManager $ 1.class])) :myAccount_S:proguardRelease FAILED 警告:无法写入资源[META-INF / NOTICE](重复的zip条目[jackson-databind-2.2.3.jar:META-INF / NOTICE]) 警告:无法写入资源[META-INF / LICENSE](重复的zip条目[jackson-databind-2.2.3.jar:META-INF / LICENSE])
gradle:
buildTypes {
release {
minifyEnabled true
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/MANIFEST'
}
dependencies {
buildTypes {
release {
minifyEnabled true
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/MANIFEST'
}
}
答案 0 :(得分:1)
只有当jackson-databind-2.2.3.jar被多个项目使用时才会出现这种情况。唯一的解决方案是使用maven中央存储库或创建第三个项目,并在之前使用jackson-databind-2.2.3.jar将其用作项目中的依赖项。
答案 1 :(得分:-1)
似乎问题是由LICENSE,NOTICE和其他文件冲突引起的。而不是排除,检查这样的事情是否解决了问题:
packagingOptions {
pickFirst 'META-INF/NOTICE'
pickFirst 'META-INF/LICENSE'
pickFirst 'META-INF/MANIFEST'
pickFirst 'META-INF/LICENSE.txt'
pickFirst 'META-INF/NOTICE.txt'
pickFirst 'META-INF/MANIFEST'
}