Android Studio lint.xml configuration

androidlintxml

I would like to configure lint in Android Studio to ignore some file. I have placed the lint.xml file in app/ folder. Here is the content of the lint file:

<?xml version="1.0" encoding="UTF-8"?>
<lint>
    <issue id="UnusedResources">
        <ignore path="res/drawable/background_palette_drawable_6.xml" />
    </issue>
</lint>

When I run lint to check for unused resources it still finds this file as unused.

In app build.gradle I have:

lintOptions {
    disable 'InvalidPackage'
    abortOnError false
    absolutePaths false
    lintConfig file('lint.xml')
}

I have tried changing the file path to /app/src/main/res/drawable/background_palette_drawable_6.xml
and still it does not work.

I put <issue id="UnusedResources" severity="ignore"> and in that case it just ignores all the unused resources so it seems the file lint.xml is found correctly but maybe something is wrong with the path?

Best Answer

Consider using path="**/background_palette_drawable_6.xml" with the ** glob pattern to match the file regardless of its location.