如何从库中删除未使用的资源? [英] How to remove unused resources from libraries?

查看:125
本文介绍了如何从库中删除未使用的资源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

起初,我知道从Android项目删除所有未使用的资源,但只适用于项目。

At first I know Remove all unused resources from an android project, but that is only for projects.

我想从库中删除未使用的图像,如谷歌播放服务或耐磨SDK。我已经知道我可以通过删除不必要的摇篮语言 resConfigs ,但我不知道如何删除图像和布局,我不使用。有没有什么办法来避免他们被添加?

I want to remove unused images from a library like the Google Play Services or the Wearable SDK. I already know that I can remove unwanted languages in gradle by using resConfigs, but I don't know how to remove images and layouts which I don't use. Is there any way to avoid that they are added?

推荐答案

我几乎错过它来写,现在有一个很好的解决方案:

I almost missed it to write that there is now a nice solution:

android {
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
        }
    }
}

这是由Tor的诺尔比耶为构建工具0.14版上公开宣布 Google+的。 0

This was annouced on Google+ by Tor Norbye for the build tools version 0.14.0

这篇关于如何从库中删除未使用的资源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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