1

當我建立一個發佈版本,我得到以下警告的gradle:搖籃(ProGuard的)異常,而處理任務java.io(複製ZIP條目)

Warning:Exception while processing task java.io.IOException: 
Can't write [C:\Users\MyName\AndroidStudioProjects\MyApp\app\build\intermediates\transforms\proguard\free\release\jars\3\1f\main.jar] 
(Can't read [C:\Users\MyName\AndroidStudioProjects\MyApp\app\build\intermediates\classes\free\release(;;;;;;**.class)] 
(Can't read [com] (Can't read [android] (Can't read [vending] (Can't read [billing] 
(Can't read [IInAppBillingService$Stub$Proxy.class] 
(Duplicate zip entry [com/android/a/a/a$a$a.class == com/android/vending/billing/IInAppBillingService$Stub$Proxy.class]))))))) 

和錯誤:

Error:Execution failed for task 
':app:transformClassesAndResourcesWithProguardForFreeRelease'. 
> Job failed, see logs for details 

可能某種ProGuard問題。這是因爲我一直在嘗試實施新的Play Billing Library。我嘗試清理並重建項目(多次),並使緩存失效並重新啓動,但都無濟於事。

注意真的要確定在這裏包含哪些資源...以下是可能相關的片段。

build.gradle

compileSdkVersion 26 
buildToolsVersion '26.0.1' 
defaultConfig { 
    minSdkVersion 16 
    targetSdkVersion 26 
} 

buildTypes { 
    release { 
     minifyEnabled true 
     proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 
    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    compile project(':playLicensing') 
    compile 'com.android.billingclient:billing:1.0' 
    compile 'com.firebase:firebase-jobdispatcher:0.8.3' 
    compile 'com.google.android.gms:play-services-location:11.4.2' 
    compile 'com.google.android.gms:play-services-places:11.4.2' 
    compile 'com.google.android.gms:play-services-auth:11.4.2' 
    compile 'com.google.guava:guava:23.1-android' 
    compile 'com.android.support:appcompat-v7:26.0.2' 
    compile 'com.android.support:design:26.0.2' 
} 

proguard-rules.pro

-dontwarn com.google.** 
-keepattributes EnclosingMethod 
-keepattributes JavascriptInterface 
-keepclassmembers class * { 
    @android.webkit.JavascriptInterface <methods>; 
} 
-assumenosideeffects class android.util.Log { 
    public static boolean isLoggable(java.lang.String, int); 
    public static int v(...); 
    public static int i(...); 
    public static int w(...); 
    public static int d(...); 
    public static int e(...); 
} 
-printmapping mapping.txt 

回答

2

好吧,我想通了什麼問題了。通過previous in-app billing implementation,有一個requirement可將IInAppBillingService.aidl文件放入項目的aidl子文件夾中。這是我的:

enter image description here

我已經刪除了所有舊帳單的東西,除了該文件...但現在我已經刪除了太多,所有的罰款與構建我的應用程序與新的Play結算圖書館。

+1

謝謝,它解決了我的問題 – Vitaly

0

同樣的問題發生在我身上,但隨着goolge服務授權。問題是我甚至不使用那個庫。不知道如何解決這個問題...