Ignoring IconDensities lint warning for specific files

Viewed 568

I am trying to ignore the IconDensities lint warning for some specific files.

This is the lint warning that I get:

Usability:Icons
1   warning IconDensities: Icon densities validation

Icon densities validation
../../../src/main/res/drawable-xxhdpi: Missing the following drawables in drawable-xxhdpi: 
my_image_1.png, my_image_2.png, my_image_3.png, my_image_4.png, my_image_5.png... (22 more)

Now, let's say I only want to ignore the warning for the first file my_image_1.png, but not the others.

I have a lint.xml file that defines lint rule exceptions:

<lint>
    ...

    <issue id="IconDensities">
        <ignore path="src/**/res/drawable-xxhdpi/my_image_1.png" />
    </issue>
</lint>

Unfortunately this does not work and the file still shows up in the warning. If I use regexp instead of the path, then all files get ignored.

Btw: i know I should fix it by providing the file in all densities, but that is not what I am looking for right now.

Edit 01/18/2019:

Looking at the class that actually performs the lint check here, I don't see anything in there that would make it possible to ignore a single file. So this might just really not be possible :-(

1 Answers

Have you tried formatting the ignore path slightly differently?

<issue id="IconDensities">
    <ignore path="**/res/drawable-xxhdpi/my_image_1.png"/>
</issue>

The ignore path pointing to the wrong place seems a likely reason for it to still show up in a warning!

Related