迁移到Android Studio 3.0后,未在调试版本中压缩可绘制的'png' [英] After migrate to Android Studio 3.0 drawable 'png' NOT compressed in debug build

查看:132
本文介绍了迁移到Android Studio 3.0后,未在调试版本中压缩可绘制的'png'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以发布版本类型压缩的可绘制对象,但未以调试版本类型压缩的可绘制对象.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆