skip to Main Content

When i build the app i got error

> Could not create task ':app:compileDebugKotlin'.
> Could not create task ':app:dataBindingGenBaseClassesDebug'.
> Cannot use @TaskAction annotation on method DataBindingGenBaseClassesTask.writeBaseClasses() because interface org.gradle.api.tasks.incremental.IncrementalTaskInputs is not a valid parameter to an action method.

2

Answers


  1. I got the same error when I set the Gradle version as 8.0 milestone-5 in the Project Structure…-> Project. Changing on 7.6 version fixed the issue.

    Login or Signup to reply.
  2. I was getting following error while building the project while moving up from 7.x to 8.x,

    Cannot use @TaskAction annotation on method DataBindingGenBaseClassesTask.writeBaseClasses() because interface org.gradle.api.tasks.incremental.IncrementalTaskInputs is not a valid parameter to an action method.
    

    I had to go through following steps as I didn’t had downgrading option as in accepted answer. I was using Android Studio chipmunk which would let me select latest Gradle Version but not Android Gradle Plugin & Kotlin Gragle Plugin.

    • If you are on AGP 7.2+ use ./gradlew -Pandroid.debug.obsoleteApi=true to get prominent warning for APIs which might fail in 8.

    • Upgrade Android Studio which will give you access to latest AGP & KGP. I upgraded to Eel 2022.1.1.
      If you try to upgrade kotlin gradle plugin to latest with older Android Studio you’d get,

    Kotlin version that is used for building with Gradle differs from the
    one bundled into the IDE

    • Set compileOptions & kotlinOptions to Java 11. Below 11 is not accepted.

    • Update kotlin-gradle-plugin.

    • Remove kotlin-android-extensions plugin if is in used.

    • Add kotlin-parcelize plugin for accessing Parcelize class.

    • Change kotlinx.android.parcel to kotlinx.parcelize.

    • Remove jcenter.

    • Replace deprecated onBackPressed() with

       onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
           override fun handleOnBackPressed() {
               // your code
           }
       })
      
    • Upgrade libraries in dependencies. Retrofit library was giving an issue while building.

    Finally I could build the project. Here are the versions,

    enter image description here

    Also, these steps helped me to resolve the issue, yours might differ.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search