shrinkResources set to true, but all unused resources (specifically drawables) not getting removed

喜夏-厌秋 提交于 2019-11-29 06:12:16
Dilroop Singh

R.raw.Keep (xml file)

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
    tools:shrinkMode="strict" />

Dont forget to Reference this Resource from .java source file. For more details see this

if you are worried about the size of your apk file then its good practice to shrink image files as well. That is convert RGB channel to Indexed channel,this can save up to 50% more space.

Use this site to Shrink your images media4x.com

To turn off the safety checks, set the shrinkMode to "strict" as in the following keep.xml file:

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
    tools:shrinkMode="strict" />

From: http://tools.android.com/tech-docs/new-build-system/resource-shrinking

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