Droidman
Droidman

Reputation: 11608

android - automatically detect unused drawables

The matter: I used many icons and pictures while developing an android application, later I replaced many of them but kept the old ones in case I would need to use them again. Now I have a huge amount of .png's in my drawable folder, many are now unused and it would take ages to manually sort them out. Is there a way to detect drawables to which no references exist?

Upvotes: 3

Views: 3053

Answers (2)

Robert Nekic
Robert Nekic

Reputation: 3107

In my experience, Lint does not detect unreferenced PNGs. It finds unreferenced layouts and drawable XML files like shapes and selectors but not PNGs. I stumbled upon this Python script for removing unreferenced PNG drawables. It worked well with my project but, as the documentation for it says, make sure you are using source control just in case.

https://github.com/instructure/android-ImageSweep

Upvotes: 4

Jose-Rdz
Jose-Rdz

Reputation: 539

You can use Android Lint Tool, follow the link I provide , as an overview it states:

  • Missing translations (and unused translations)
  • Layout performance problems (all the issues the old layoutopt tool used to find, and more)
  • Unused resources
  • etc.

As an alternative this project might help you (pretty easy to use):

https://code.google.com/p/android-unused-resources/

Hope it's useful...

Upvotes: 12

Related Questions