How to avoid unused resources and code from an Android Library Project getting into my APK?

前端 未结 3 539
[愿得一人]
[愿得一人] 2021-02-08 17:01

I have an Android Library Project in my Eclipse workspace, that I use as a unique toolbox. By chance(1), I just discovered that resources from the library (xml animations, xml l

3条回答
  •  别跟我提以往
    2021-02-08 17:46

    As somebody said before, Proguard can strip unused code.

    To remove unused resources you can use Android Lint tool from ADT 16. It will help you not only to remove unused resources, but also to find potential bugs. This quote is 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.

提交回复
热议问题