WARNING: API 'variant.getPackageLibrary()' is obsolete and has been replaced with 'variant.getPackageLibraryProvider()'

If you debug, it shows REASON: The Kotlin plugin is currently calling this API. We are working to solve this.

To see this error please run ./gradlew -Pandroid.debug.obsoleteApi=true --stacktrace


As tommyboy said, the Kotlin plugin is calling this deprecated API. If you don't want to get this warning while Kotlin is working on this, you can just use the previous version of Kotlin plugin like:

dependencies {
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.21"
}

It's probably a bug and fixed soon

You can revert back to the previous version or add this line to gradle.properties

android.debug.obsoleteApi=true

In my project gradle file I had

buildscript {
    ext.kotlin_version = '1.3.31'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

Simple changing ext.kotlin_version = '1.3.31' to ext.kotlin_version = '1.3.41' solved the problem

when using version 1.3.31 i had tried gradlew -Pandroid.debug.obsoleteApi=true

It mentioned

WARNING: API 'variant.getPackageLibrary()' is obsolete and has been replaced with 'variant.getPackageLibraryProvider()'. It will be removed at the end of 2019. For more information, see https://d.android.com/r/tools/task-configuration-avoidance.

REASON: The Kotlin plugin is currently calling this API. We are working to solve this.

WARNING: Debugging obsolete API calls can take time during configuration. It's recommended to not keep it on at all times.

Looks like it is solved in 1.3.41