Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a tool to find unused resources in an Android project? [closed]

I'd like to find any unused resources in my Android project - this includes strings, ids, drawables, integers etc.

Does a tool to do this currently exist (preferably for Eclipse)?

like image 314
Joseph Earl Avatar asked Apr 28 '11 20:04

Joseph Earl


People also ask

How do I find unused resources in Android?

You can easily search for unused resources from Android Studio. Just press Ctrl Alt Shift i and type "unused resources" (without quotes). That will execute lint.


2 Answers

A friendly note: The IntelliJ idea ONLY works for resources that are not referenced in JAVA code. So if you have 1500 resources and only 20 are referenced directly from your java code, you end up with 1480 unused warnings in that file.

I'm seeing things marked as unused that I can clearly see are in use in various layouts. So keep that in mind ... don't go on a deleting spree.

like image 63
copolii Avatar answered Oct 09 '22 02:10

copolii


Update to ADT 16 and use Android Lint. It is really amazing tool.

Android Lint is a new tool for ADT 16 (and Tools 16) which scans Android project sources for potential bugs.

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. 
like image 25
Andrei Buneyeu Avatar answered Oct 09 '22 02:10

Andrei Buneyeu