问题
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