i have faced same error with this Could not create task ':app:compileDebugKotlin'. Cannot use @TaskAction annotation on method AbstractKotlinCompile.execute() because interface org.gradle.api.tasks.incremental.IncrementalTaskInputs is not a valid parameter to an action method.
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22"
// Use thelatest stable version
}
distributionUrl=https://services.gradle.org/distributions/gradle8.5all.zip
classpath 'com.android.tools.build:gradle:8.2.0'
// Use the latest AGP version