Android Gradle 2.2 Do not allow ShrinkResources for signed APK

As part of the deployment of Android Studio 2.2, I updated the Gradle Build tools to version v2.2. After that, my signed APK build process failed because I have shrinkResources = true.

As soon as I return to Gradle v2.1.3 or set shrinkResources = false, everything works fine. Here is my Gradle application build file:

    android {
    signingConfigs {

    }
    compileSdkVersion 24
    buildToolsVersion '24.0.0'
    defaultConfig {
        applicationId "com.sample.testapp"
        minSdkVersion 21
        targetSdkVersion 24
        versionCode 4
        versionName "0.0.4"
    }
    buildTypes {
        release {
            minifyEnabled false
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            proguardFile 'C:/Users/code/testapp/app/proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

With Gradle, set in v2.2 here the build error that I get when creating a signed APK

enter image description here

- , , ? Google , Android - - Gradle - , > 6 ( Gradle).

P.S. , minifyEnabled = false , proguard , Signed Build - .

+4
2

shrinkResources, minifyEnabled

Android:

. , , , . true, , , - , unreferenced , , .

, shrinkResources true build.gradle( minifyEnabled ).

+7

minifyEnabled false
shrinkResources false

minifyEnabled true
shrinkResources true

android gradle

Google

+3

Source: https://habr.com/ru/post/1655413/


All Articles