Jos*_*arl 43 resources android find
我想在我的Android项目中找到任何未使用的资源 - 包括字符串,id,drawable,整数等.
目前是否存在执行此操作的工具(最好是Eclipse)?
cop*_*lii 34
友情提示:IntelliJ构思仅适用于JAVA代码中未引用的资源.因此,如果您有1500个资源,并且只有20个直接从您的Java代码中引用,那么您最终会在该文件中发出1480个未使用的警告.
我看到标记为未使用的东西,我可以清楚地看到它们在各种布局中使用.所以记住这一点......不要继续删除狂欢.
And*_*yeu 34
更新到ADT 16并使用Android Lint.这真是太神奇了.
Android Lint是ADT 16(和工具16)的新工具,它可以扫描Android项目源中的潜在错误.
Here are some examples of the types of errors that it looks for:
- 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
and many more.
Run Code Online (Sandbox Code Playgroud)
kar*_*arl 19
Andrei Buneyeu是正确的Android Lint是要走的路.要专门回答任何其他人的问题,命令是:
lint --check UnusedResources <path to project>
你可以看到lint中有很多选项lint --list
.
ada*_*dam 18
如果您使用在免费社区版中具有Android支持的IntelliJ,您可以通过打开生成的R.java文件(gen/R.java)来完成此操作.未使用的资源将标记为警告,以便在项目的任何位置不被引用.
如果Eclipse没有做同样的事情,我会感到惊讶.
android-unused-resources是一个Java工具,可以检测未使用的资源,并告诉您它们的位置.它处理Java和XML文件,因此它避免了接受的答案中的问题.
它并不完美,但只要您不动态加载资源(getIdentifier(java.lang.String, java.lang.String, java.lang.String
)),它就不应该告诉您删除任何实际使用的内容(尽管即使发生这种情况您也会遇到编译器错误).
归档时间: |
|
查看次数: |
25078 次 |
最近记录: |