2

当我构建发布版本时,我收到以下 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
4

2 回答 2

2

好的,我弄清楚了问题所在。在之前的应用内计费实施中,需要IInAppBillingService.aidl文件放入aidl项目的子文件夹中。这是我的:

在此处输入图像描述

我已经删除了除该文件之外的所有旧计费内容......但现在我也删除了它,使用新的 Play 计费库构建我的应用程序一切都很好。

于 2017-10-14T12:39:41.760 回答
-1

同样的问题发生在我身上,但与 goolge 服务身份验证有关。问题是我什至不使用那个库。不知道如何解决这个问题...

于 2017-11-02T17:42:33.380 回答