重复的zip条目[com / android / vending / billing / IInAppBillingService.class]

时间:2016-05-31 07:06:07

标签: android proguard

我正在开发一个图书馆项目,该项目也可以处理应用内购买。所以我要包含IInAppBillingService.aidl文件以及IabHelper类。

问题是,当我的libarary用户也使用另一个使用IInAppBillingService.aidl界面的第三方库时。

然后他得到了重复的zip条目错误:

java.io.IOException: Can't write [app/build/intermediates/transforms/proguard/debug/jars/3/1f/main.jar] (Can't read [app/build/intermediates/classes/debug(;;;;;;**/*.class)] (Duplicate zip entry [com/android/vending/billing/IInAppBillingService.class]))

-injars libs/mylib.aar(!com/android/vending/billing/IInAppBillingService.class)添加到他的proguard-rules.txt无济于事。

如何解决这个问题?

2 个答案:

答案 0 :(得分:0)

您正在使用包含重复文件的库,这是gradle中的错误,解决在项目build.gradle中使用它的问题

android {
packagingOptions {
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude '.readme'
   }
}

答案 1 :(得分:0)

如果具有重复文件的库在android{}

中使用此文件
 packagingOptions {
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/DEPENDENCIES'
    exclude '.readme'

}