美文网首页
自定义lint 报错:Obsolete custom lint

自定义lint 报错:Obsolete custom lint

作者: 星辰大海TT | 来源:发表于2020-06-17 16:13 被阅读0次

    问题描述

    自定义lint打包引入项目之后报这个错:

    ../../../../../.gradle/caches/transforms-2/files-2.1/c12c4803ae0631ff7fb0c463238fc97e/jars/lint.jar: Lint found an issue registry (******.CustomIssueRegistry) which requires a newer API level. That means that the custom lint checks are intended for a newer lint version; please upgrade.

    这个错是因为我们引用的lint-api与系统的Android Gradle Plugin 不一致造成的,如
    我们引用的:

        compileOnly "com.android.tools.lint:lint-api:27.0.0"
        compileOnly "com.android.tools.lint:lint-checks:27.0.0"
    

    而我们主项目的gradle tools的版本是

    dependencies {    classpath 'com.android.tools.build:gradle:3.4.1'}
    

    要解决这个问题需降级com.android.tools.lint的依赖包,或升级com.android.tools.build:gradle。

    最终我通过降级lint的版本解决问题。

    compileOnly "com.android.tools.lint:lint-api:26.4.1"
    compileOnly "com.android.tools.lint:lint-checks:26.4.1"
    

    相关文章

      网友评论

          本文标题:自定义lint 报错:Obsolete custom lint

          本文链接:https://www.haomeiwen.com/subject/duybzhtx.html