Home » Android » Unused String and Image Resources in Android

Unused String and Image Resources in Android

Posted by: admin April 23, 2020 Leave a comment


My project has a large number of String and ImageResources, many of which i feel are unused. Is there any way i can find out which of these resources are currently not been referenced from my code?

How to&Answers:

In Android Studio (tried up to Version 2.1.3), you can simply go to Main Menu -> Analyze -> Run Inspection by Name…, and select Unused resources

enter image description here

(It runs Android Lint for you.)


In Android Studio there is a shortcut available.

Press Ctlr + Alt + Shift + i (or Cmd + Option + Shift + i on Mac)

This will open a dialog in which you can type “Unused” to see a number of options.

I generally type “unused resources” and get a list including layouts, strings, drawables, etc.


In Android Studio 2.0 and above

in menu select Refactor–>click on Remove Unused Resources…


Improving @Ramesh R answer, the best way is Right click on your res folder, Select Refactor and Remove Unused Resources.

This tool is fantastic, my applauses to his developer xD;


you can use lint

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.


Yes, the ADT in eclipse includes android lint

Refer android lint


You can use this library
Place it to project folder and run jar from command line.


Regarding the image resources you would like to remove, you should also consider moving all the drawable-xxxx folders out of your project into a temporary folder, then do a rebuild all, and take a look at the build message list which will tell you which ones are missing.

This can be specially useful if you want to get an overview of which resources you are effectively using and maybe replace them with an icon font or svg resources, possibly with the help of the Android Iconics library.


If you want to delete unused resources in drawable file :
Click on drawable file ~ then Click Refactor ~ then Click Remove Unused Resources..