I just completed my android app. I want to clean up the unused layout files and other resource files such as images and drawables and strings which are not referenced in the actual code. How do I do that? Is there any option to do this in Android Studio?
Asked
Active
Viewed 8,022 times
9
-
1Does this answer your question? [Remove all unused resources from an android project](https://stackoverflow.com/questions/6373482/remove-all-unused-resources-from-an-android-project) – Richard Le Mesurier Mar 23 '22 at 05:44
2 Answers
19
You can able to remove unused resources by following way.
Analyze
>Inspect Code
and find Unused Declarations and Methods.Android Studio -> Menu -> Refactor -> Remove Unused Resources.

pRaNaY
- 24,642
- 24
- 96
- 146
-
Beware of running the automatic Removal these days. The detection phase is not 100% perfect, given current tooling. – Richard Le Mesurier Mar 23 '22 at 05:44
0
You can easily search for unused resources from Android Studio. Select res folder -> Just press Ctrl+Alt+Shift+i and type "unused resources" (without quotes). That will execute lint. Super easy way to run lint commands (and other stuff from IDE).
Click on remove all unused resources.

Yamini
- 732
- 7
- 11