android - “Obsolete custom lint check” 来自 `androidx.appcompat.AppCompatIssueRegistry`,这需要更新的 API 级别

标签 android android-lint android-api-levels

我有一个项目,其中我收到以下 Android lint 警告:

Obsolete custom lint check

../../../../../../../.gradle/caches/transforms-2/files-2.1/fc4398fa701898f50fcec85691d33578/appcompat-1.2.0/jars/lint.jar: Lint found an issue registry (androidx.appcompat.AppCompatIssueRegistry) which requires a newer API level. That means that the custom lint checks are intended for a newer lint version; please upgrade Lint can be extended with "custom checks": additional checks implemented by developers and libraries to for example enforce specific API usages required by a library or a company coding style guideline.

The Lint APIs are not yet stable, so these checks may either cause a performance degradation, or stop working, or provide wrong results.

This warning flags custom lint checks that are found to be using obsolete APIs and will need to be updated to run in the current lint environment.

It may also flag issues found to be using a newer version of the API, meaning that you need to use a newer version of lint (or Android Studio or Gradle plugin etc) to work with these checks. To suppress this error, use the issue id "ObsoleteLintCustomCheck" as explained in the Suppressing Warnings and Errors section.

ObsoleteLintCustomCheck Warning Priority 10/10


我什至不知道这意味着什么,我不使用任何定制的 lint thingies。它也只出现在应用程序模块中,而不是库模块中。
我刚刚碰到了my project从 API 26 到 30 并切换到 AndroidX/JetPack。
要重现它,请克隆项目,查看 commit 96273fd8b1af5d5c63603b7df71e0849f518a9e5 , 改为 android/子目录并运行 ./gradlew lint .我不知道这是否可以减少或如何减少(我是 Android 开发的新手,诅咒它的问题,自 1980 年代后期以来一直在开发软件)。

最佳答案

该问题是由 appcompat 中包含的 lint 检查引起的。应用程序模块中的依赖项。如警告消息中所述,lint 检查是使用旧 API 编译的。
有两种方法可以解决它。

  • 更新到最新版本 1.3.0-beta01
    implementation 'androidx.appcompat:appcompat:1.3.0-beta01'
  • 抑制 lintOptions 中的 lint 警告堵塞
    
    android {
        lintOptions {
            disable 'ObsoleteLintCustomCheck'
        }
    }
    
  • 关于android - “Obsolete custom lint check” 来自 `androidx.appcompat.AppCompatIssueRegistry`,这需要更新的 API 级别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65479506/

    相关文章:

    android - 在 Android Studio 上,检查 "Unused resources"不适用于我项目中的所有模块

    android - 是否可以将网页或内容从 web 拉到 android 主屏幕上的小部件中?

    android - 无法编译cwm恢复

    java - 如何按索引顺序将两个arraylist合并为一个arraylist

    android - Sonar Android Plugin 添加自定义规则

    java - 如何添加默认构造函数

    android - 如何检查任何设备是否支持表情符号?

    java - 位图 API 上的 ScriptIntrinsicBlur<14

    android - Text to Speech 不能在 API 级别 30 中工作,而不是英语

    javascript - 用javascript检测Android(不是chrome)?