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

杀马特。学长 韩版系。学妹 提交于 2019-12-13 20:27:57

问题


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?


回答1:


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
    }


来源:https://stackoverflow.com/questions/47505676/after-migrate-to-android-studio-3-0-drawable-png-not-compressed-in-debug-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!