Android Studio lint.xml configuration

孤街醉人 提交于 2019-12-23 07:50:04

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/34896452/android-studio-lint-xml-configuration

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!