Android Studio Lint Warning: Unstable @Incubating

190 views Asked by At

After migrating from Groovy to Kotlin DSL the settings.gradle is now getting a lint warning about the usage of this code

repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven {
            url = uri("https://jitpack.io")
        }
    }

enter image description here enter image description here

Currently using AGP 8.1.3

Even when creating a new project using the IDE's template that is in Kotlin DSL, the above configuration exist and also got warning.

Why this is not showing when using Groovy, it seems there is an issue with Kotlin DSL or the lint just cannot detect it when in Groovy?

1

There are 1 answers

1
Nazarii Moshenskyi On BEST ANSWER

If you convert the dependencyManagement {} block back to Groovy DSL and try to navigate to repository handler, for example, you end up in the same file with same @Incubating annotations: https://github.com/gradle/gradle/blob/master/subprojects/core-api/src/main/java/org/gradle/api/initialization/resolve/DependencyResolutionManagement.java#L44

But why does it show warnings for Kotlin but not for Groovy? According to this answer in the Gradle GitHub repo: https://github.com/gradle/gradle/issues/20328#issuecomment-1083788360

The problem is not with Gradle. It's the way Intellij-based IDEs run their inspections on .gradle and .kts files. The Unstable API usage inspection not working for .gradle files for some reason.

Seems like to make it work IntelliJ guys should add it to the Gradle sections in their Inspection catalog. As for now, seems like it can handle only @Deprecated annotation