2016-05-31 33 views
0

我正在開發一個也處理應用內購買的庫項目。所以我包括IInAppBillingService.aidl文件和IabHelper類。重複壓縮條目[com/android /自動售貨機/計費/ IInAppBillingService.class]

問題是,當我的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沒有幫助。

如何解決這個問題?

+0

你解決了你的問題嗎?如果是,如何? – Palaima

+0

@Palaima我做了另一個可選版本的庫,標記爲'no-billing',其中所有這些東西都被刪除。 – Pitel

回答

0

您使用的是有重複的文件庫,是gradle這個錯誤,爲解決這個問題在你的項目中使用的build.gradle

android { 
packagingOptions { 
    exclude 'META-INF/LICENSE.txt' 
    exclude 'META-INF/NOTICE.txt' 
    exclude '.readme' 
    } 
} 
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' 

}