Search code examples
androidandroid-studio-3.0aapt

After migrate to Android Studio 3.0 drawable 'png' NOT compressed in debug build


Drawables compressed in release build types, but NOT compressed in debug build types.

Android Studio 3.0 Build #AI-171.4408382, built on October 20, 2017 JRE: 1.8.0_152-release-915-b01 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Linux 4.10.0-38-generic

In previous version drawable was always compressed

How can I configure debug builds to compress png drawables also?


Solution

  • The reason for this is documented here

    Here is the quote

    If you're using Android plugin 3.0.0 or higher, PNG crunching is disabled by default for only the "debug" build type

    I solved my problem by adding crunchPngs true to debug build type configuration in the build.gradle:

    buildTypes {
        debug {
            minifyEnabled false
            shrinkResources false
            crunchPngs true # <------ This option
        }