jumper0k
jumper0k

Reputation: 2166

Android Lint does not see unused png drawables

I have many unused (hundreds) png drawables in drawable-hdpi, drawable-xhdpi... folders. Lint check gives me only unused layouts, strings, animations and xml drawables, but not png drawables. Another tool android-unused-resources gives me "0 resources found". I've checked, that drawables really unused (I have searched on a whole project for drawable name, tried to delete drawable and it was OK). Why so that and how to make lint detect them as "unused"?

Upvotes: 10

Views: 4214

Answers (3)

Uwe Post
Uwe Post

Reputation: 515

If you have a lint.xml file in your project directory, this overrides settings made in Android Studio. This happened to me somehow maybe because I imported the project from Eclipse a long time ago.

Remove the lint.xml file and Lint will use the settings made inside Android Studio using Analyze/Inspect Code.

Upvotes: 0

Adinia
Adinia

Reputation: 3731

From your comment:

I have a lint.xml file and it have many "issue", one of them: <issue id="UnusedResources" severity="ignore" />

It seems that your Lint is configured to ignore unused resources.

To change that, go in Eclipse > Preferences > Android > Lint Error Checking and either search for the UnusedResources issues, or look under the Performance tab and change the severity of this issue to at least Information or Warning, or even something more severe, as you wish.

enter image description here

Upvotes: 1

rarp
rarp

Reputation: 1122

This is just a workaround, not a fix for your issue. I noticed that lint stopped working in my environment (Eclipse) and started using the command line version of the tool which can be found in your /tools/

I run the command in the terminal with:

./lint ~/workspace/<your-project-folder>

Make sure the lint file is setup to be executed. The output will be a list of warnings from lint. I suggest copying that into a text editor in order to quickly search for keywords. All of the warnings related to your issue should be under [UnusedResources] and grouped together.

Upvotes: 0

Related Questions