迁移到Android Studio 3.0后,未在调试版本中压缩可绘制的'png' [英] 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
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
在以前的版本中,drawable始终被压缩
In previous version drawable was always compressed
如何配置调试版本以压缩png
可绘制对象?
How can I configure debug builds to compress png
drawables also?
推荐答案
这是报价
如果您使用的是Android插件3.0.0或更高版本,则PNG处理是 默认情况下,仅对调试"构建类型禁用
If you're using Android plugin 3.0.0 or higher, PNG crunching is disabled by default for only the "debug" build type
我通过添加crunchPngs true
来调试build.gradle
中的构建类型配置来解决我的问题:
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
}
这篇关于迁移到Android Studio 3.0后,未在调试版本中压缩可绘制的'png'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!