处理任务java.io时的Gradle(ProGuard)异常(重复的zip条目)

时间:2017-10-14 09:36:26

标签: android android-gradle google-play proguard play-billing-library

当我构建发布版本时,我会收到以下gradle警告:

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 个答案:

答案 0 :(得分:2)

好的,我弄明白问题是什么。使用nodeListprevious in-app billing implementationaidl文件放入项目的 Word.Range rng = Globals.ThisAddIn.Application.ActiveDocument.Paragraphs[1].Range; Word.Find searchRange = rng.Find; searchRange.ClearFormatting(); searchRange.Format = true; searchRange.Font.Name = "Calibri"; searchRange.Format = Font.Italic; object textToFind = "the"; if (searchRange.Execute(ref textToFind, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing)) { MessageBox.Show("Found text: " + textToFind, "Finding..."); rng.Font.Italic = 1; rng.Font.Color = Word.WdColor.wdColorBlue; } 子文件夹中。这是我的:

requirement

我删除了除该文件以外的所有旧计费内容...但现在我已将其删除,所有使用新的播放结算库构建我的应用程序都可以。

答案 1 :(得分:-1)

同样的问题发生在我身上,但是使用了goolge服务。问题是我甚至不使用那个lib。不知道如何解决这个问题......