在 'lintChecks' 配置中发现了多个 jar

Found more than one jar in the 'lintChecks' configuration

我想为我的项目添加自定义 lint 规则,但在同步项目时出现错误。

Execution failed for task ':app:prepareLintJar'.


Found more than one jar in the 'lintChecks' configuration. Only one file is supported. If using a separate Gradle project, make sure compilation dependencies are using compileOnly

如何检查哪个库或模块正在添加另一个 jar?

我解决了问题。我在自定义规则模块中的依赖项是

dependencies {
    api "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    compileOnly 'com.android.tools.lint:lint-api:26.5.3'
    compileOnly 'com.android.tools.lint:lint-checks:26.5.3'
}

我将 kotlin 依赖项更改为 compileOnly,它起作用了

dependencies {
    compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    compileOnly 'com.android.tools.lint:lint-api:26.5.3'
    compileOnly 'com.android.tools.lint:lint-checks:26.5.3'
}