Remove all unused resources from an android project

Steve Prentice picture Steve Prentice · Jun 16, 2011 · Viewed 171.9k times · Source

I want to remove all unused layouts, strings, drawables, colors, etc from my Android res directory. Are there any tools that will give me a list of files and I can remove from my repository and elements within specifics files (e.g. unused string entries) that are no longer used?

Answer

bakua picture bakua · Jul 28, 2015

You can easily search for unused resources from Android Studio. Just press CtrlAltShifti and type "unused resources" (without quotes). That will execute lint. Super easy way to run lint commands (and other stuff from IDE).

OR

In Android Studio Menu > Refactor > Remove Unused Resources...

Select the resources you want to remove. You can exclude resources you want to keep by right-clicking on the resource item.

Use Do Refactor to remove all Resources at once.

Update: use OptionShifti for mac