Is there any simple way to find out unused strings in Android project?

后端 未结 9 1116
傲寒
傲寒 2021-01-30 03:03

I have a huge Android project with many strings declared in strings.xml. I wanted to remove unused strings in strings.xml.

Is there any easy wa

9条回答
  •  轮回少年
    2021-01-30 03:22

    With ADT 16 you can do it as simple as possible. Update to ADT 16 and use Android Lint. It is really amazing tool. It can find all unused resources (not only strings) and many more. From its official site:

    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.
    

提交回复
热议问题