如何解决这个transformClassesAndResourcesWithProguardForRelease问题?

时间:2017-07-05 06:25:33

标签: android firebase proguard ioexception

我正在尝试生成已在版本代码编号22中的应用的签名apk,在此版本中我添加了来自Firebase的推送通知,因此我添加了Google服务。在调试我的应用程序正确运行,但当我尝试生成签名的apk时,我收到上面的警告消息:

Warning:Exception while processing task java.io.IOException:
Can't write [C:\Users\Alejandro\HCT\Project\Project-Android\app\build\intermediates\transforms\proguard\release\jars\3\1f\main.jar]
(Can't read [C:\Users\Alejandro\.android\build-cache\04825c1d096bb9aba606e23c0e99208109f6122a\output\jars\classes.jar(;;;;;;**.class)]
(Duplicate zip entry [com/google/android/gms/internal/d.class ==
classes.jar:com/google/android/gms/internal/zzab.class]))

这个错误:

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

这是我的app.gradle:

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.2'
    defaultConfig {
        applicationId "com.hct.btracker"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 22
        versionName "1.3.0"
    }
    buildTypes {
        release {
            //shrinkResources true
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            debuggable true
            signingConfig signingConfigs.config
        }
    }
    dexOptions {
        jumboMode true
    }
}

repositories {
    maven { url "https://jitpack.io" }
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile('com.mikepenz:materialdrawer:5.8.0@aar') { transitive = true }
    compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') { transitive = true; }
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.parse:parse-android:1.15.8'
    compile 'com.parse:parseui-login-android:0.0.2'
    compile 'com.parse:parseui-widget-android:0.0.2'
    compile 'com.github.PhilJay:MPAndroidChart:v2.2.4'
    compile 'com.github.hotchemi:android-rate:1.0.1'
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile 'com.facebook.android:audience-network-sdk:4.16.0'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'joda-time:joda-time:2.9.3'
    compile 'uk.co.chrisjenx:calligraphy:2.3.0'
    compile 'com.google.firebase:firebase-messaging:10.2.6'
    testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

这是我的项目:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我也有这个规则:

-keep public class com.parse.**
-dontwarn com.parse.**
-dontwarn okio.**
-dontwarn org.joda.**
-dontwarn com.github.mikephil.**
-dontwarn com.google.android.gms.**
-dontwarn com.google.ads.**
-dontwarn okhttp3.**
-printmapping build/outputs/mapping/release/mapping.txt

你能帮我解决一下这个问题吗?我只是不知道发生了什么。

提前致谢!

1 个答案:

答案 0 :(得分:0)

试试这个:

compile 'com.google.firebase:firebase-messaging:10.2.6'
    exclude group: "com.google.android.gms"
}