android - 有什么方法可以知道哪个xml文件没有在我们的项目中使用

标签 android android-xml

然而,这不是一个逻辑问题,我仍然很想知道我是否有任何在我的项目中没有使用的空闲文件。有时在一个漫长的项目之后,我们只是不知道哪个是实际文件,哪个是它的副本。有时我们只是创建一些 xml 文件来检查布局和其他效果,例如选择器或一些自定义可绘制对象。我的意思是,尽管这些文件永远不会被执行,但当我们回到有关真实身份的代码时,它会造成逻辑困惑以及文件的使用。

我读到 Proguard 在制作 apk 文件之前会删除所有未使用的文件。它也会删除所有这些 xml 文件吗?

我对 proguard 概念有点陌生。 谢谢。

最佳答案

您可以使用 AndroidLint,该工具会扫描您的项目并返回大量建议,然后返回所有未使用的资源!

http://tools.android.com/tips/lint

- Missing translations (and unused translations)
- Layout performance problems (all the issues the old layoutopt tool used to find, and more)
- Unused resources
- Inconsistent array sizes (when arrays are defined in multiple configurations)
- Accessibility and internationalization problems (hardcoded strings, missing contentDescription, etc)
- Icon problems (like missing densities, duplicate icons, wrong sizes, etc)
- Usability problems (like not specifying an input type on a text field)
- Manifest errors

关于android - 有什么方法可以知道哪个xml文件没有在我们的项目中使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17544246/

相关文章:

Android:调试触摸、焦点等下的 UI 元素

android - 从 ListView 行中删除单个项目

android - onAccessibilityEvent 根本没有被调用

android - 在Google搜索时如何从第一页获取图像?

android - 如何让水平 Linear Layout Child 包裹其内容?

Android 无法解析符号 '?attr/selectableItemBackground'

android - 连接更改上的 API Hook

Android - 参数类型为 :Exec runs automatically on build, 的顶级 gradle 任务为什么?

android expandablelistview如何设置组项目之间的空间

android - 在 BottomSheetDialogFragment 中添加/替换 Fragment