lint.xml 中的 issues.ignore.path 元素相对于什么路径?

Ten*_* Yu 4 android lint android-gradle-plugin

根据Android Studio Documentation - Lint我们可以这样编写 lint.xml:

<?xml version="1.0" encoding="UTF-8"?>
<lint>
    <issue id="ObsoleteLayoutParam">
        <ignore path="res/layout/activation.xml" />
        <ignore path="res/layout-xlarge/activation.xml" />
    </issue>
</lint>
Run Code Online (Sandbox Code Playgroud)

将特定路径列入白名单,但文档未指定该路径是相对路径还是绝对路径。从示例的外观来看,它似乎是相对的,但它没有指定路径是相对于什么的。当我在 build.gradle 中设置了多个源路径时,这会更加令人困惑。

Ten*_* Yu 5

经过深入测试,结论是:

它要么是绝对的,要么是相对的。(可能两者都有?但尚未测试)。

当它是相对的时,它是相对于模块的根目录(build.gradle 所在的位置)的。

您始终可以使用 **/ 通配符使其相<ignore path="**/res/layout/activation.xml" />对于任何路径。

澄清:

  • 它与 lint.xml 所在的位置无关(如果您使用 android.LintOptions.lintConfig 设置了 lint.xml 的另一个路径)

  • 它与您使用 android.sourceSets 设置的源无关