启用proguard后调试应用程序构建失败

时间:2017-11-17 06:53:40

标签: android android-gradle minify android-proguard multidex

Error:Execution failed for task 
':app:transformClassesWithAndroidGradleClassShrinkerForDebug'. 
Warnings found during shrinking, please use -dontwarn or -ignorewarnings to suppress them.

我该如何解决这个问题?

PS-我也希望在我的应用程序中使用progaurd

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'

    dexOptions{
        javaMaxHeapSize="2g"
    }

    defaultConfig {
        applicationId "com.example.projetinnovation.newadvocatediary"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        multiDexEnabled=true

    }
    buildTypes {
        debug {
            minifyEnabled true
            useProguard false
            proguardFiles getDefaultProguardFile('proguard-andr    oid.txt'),
                    'proguard-rules.pro'
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.    txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    maven {
        url "https://jitpack.io"
    }
    google()
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(path: ':agendacalendarview')
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.2'
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support:design:26.+'
    compile 'com.loopj.android:android-async-http:1.4.9'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.mcxiaoke.volley:library:1.0.19'
    compile 'com.google.code.gson:gson:2.8.+'
    compile 'com.github.clans:fab:1.6.4'
    compile 'com.github.dmytrodanylyk.android-process-button:library:1.0.4'
    compile 'com.google.firebase:firebase-messaging:10.0.1'
    testCompile 'junit:junit:4.12'
    compile 'com.github.ybq:Android-SpinKit:1.1.0'
    compile 'com.android.support:cardview-v7:26.+'
    compile 'com.github.d-max:spots-dialog:0.7@aar'
    compile 'com.github.ganfra:material-spinner:2.0.0'

    compile 'com.android.support:multidex:1.+'
}

apply plugin: 'com.google.gms.google-services'

1 个答案:

答案 0 :(得分:0)

您需要在proguard-rules.pro中的所有第三方库中添加-dontwarn或-ignorewarnings您可以在docs / wiki页面上找到相关说明