drmrbrewer
drmrbrewer

Reputation: 12989

Gradle (ProGuard) Exception while processing task java.io (Duplicate zip entry)

When I build a release version I get the following gradle warning:

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])))))))

and error:

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

Probably some sort of ProGuard issue. It's since I've been trying to implement the new Play Billing Library. I've tried to clean and rebuild the project (several times), and invalidate caches and restart, all to no avail.

Note really sure what resources to include here... the following are snippets of what may be relevant.

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

and from 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

Upvotes: 2

Views: 912

Answers (2)

Telmo M
Telmo M

Reputation: 69

The same issue is happening to me but with the goolge services auth. The problem is that I don't even use that lib. No idea how to solve this...

Upvotes: -1

drmrbrewer
drmrbrewer

Reputation: 12989

OK I figured out what the problem was. With the previous in-app billing implementation, there was a requirement to place an IInAppBillingService.aidl file into an aidl subfolder in your project. This is mine:

enter image description here

I had removed all the old billing stuff except for that file... but now that I've removed that too, all is fine with building my app with the new Play Billing Library.

Upvotes: 2

Related Questions