“Obsolete custom lint check” from `androidx.appcompat.AppCompatIssueRegistry` which requires a newer API level
Asked Answered
T

2

7

I’ve got a project in which I get the following Android lint warning:

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

I have no idea what that even means, I don’t use any custom lint thingies. It also only occurs in the app module, not in a library module.

I had just bumped my project from API 26 to 30 and switched to AndroidX/JetPack.

To reproduce it, clone the project, check out commit 96273fd8b1af5d5c63603b7df71e0849f518a9e5, change to the android/ subdirectory and run ./gradlew lint. I’ve got no idea whether this can be reduced or how (I’m new to Android development, cursing the sky red about issues with it, having been developing software since the later 1980s).

Templin answered 28/12, 2020 at 14:52 Comment(2)
Hi. Were you able to find a solution to this problem?Mandel
@kapilthadani unfortunately noTemplin
H
8

The issue is caused by the lint checks which are included in the appcompat dependency in your app module. The lint checks were compiled using old API as is said in the message of the warning.

There are two ways how you can resolve it.

  1. Update to latest version 1.3.0-beta01

    implementation 'androidx.appcompat:appcompat:1.3.0-beta01'
  2. Suppress the lint warning in the lintOptions block

    
    android {
        lintOptions {
            disable 'ObsoleteLintCustomCheck'
        }
    }
    
Hoad answered 4/3, 2021 at 18:51 Comment(0)
T
0

appcompat 1.2 uses lint checks of a later version, specifically, build tools 4.0.

Thus, if you upgrade appcompat to 1.2, (directly or indirectly), it is better that you also upgrade your com.android.tools.build:gradle to a compatible version.

The following update should work in your topmost build.gradle:

classpath 'com.android.tools.build:gradle:4.0.2'
Top answered 8/3, 2021 at 11:40 Comment(1)
I cannot upgrade to that version because I then hit youtrack.jetbrains.com/issue/IDEA-258598 (basically, IntelliJ marks my build.gradle files as having errors). That’s why I’m currently stuck with classpath 'com.android.tools.build:gradle:3.6.4'.Templin

© 2022 - 2024 — McMap. All rights reserved.