I believe that AGP 8.2.1 has some compatibility issues with Kotlin 1.9.20.
Also BaseVariant API was deprecated and basically removed in newer AGP versions.
To fix your build you should align your Kotlin version with your AGP version, all the info can be found via this link: AGP, D8, and R8 versions required for Kotlin versions
To further fix your build you should update your Gradle Wrapper to 8.6
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
and also update your android/build.gradle
to the right version:
buildscript {
ext.kotlin_version = '1.9.22'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.6.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}