从 android 项目中删除所有未使用的资源 [英] Remove all unused resources from an android project

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

问题描述

我想从我的 Android res 目录中删除所有未使用的布局、字符串、可绘制对象、颜色等.是否有任何工具可以为我提供文件列表,我可以从我的存储库中删除不再使用的特定文件(例如未使用的字符串条目)中的元素?

I want to remove all unused layouts, strings, drawables, colors, etc from my Android res directory. Are there any tools that will give me a list of files and I can remove from my repository and elements within specifics files (e.g. unused string entries) that are no longer used?

推荐答案

您可以从 Android Studio 轻松搜索未使用的资源.只需按 CtrlAltShifti 并输入未使用的资源"(不带引号)).这将执行 lint.运行 lint 命令(以及来自 IDE 的其他内容)的超级简单方法.

You can easily search for unused resources from Android Studio. Just press CtrlAltShifti and type "unused resources" (without quotes). That will execute lint. Super easy way to run lint commands (and other stuff from IDE).

Android Studio 菜单 > 重构 > 删除未使用的资源...

选择要删除的资源.您可以通过右键单击资源项来排除要保留的资源.

Select the resources you want to remove. You can exclude resources you want to keep by right-clicking on the resource item.

使用进行重构一次性删除所有资源.

Use Do Refactor to remove all Resources at once.

更新:使用 OptionShifti for mac

Update: use OptionShifti for mac

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

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