[SOLVED] Execution failed for task ':app:kaptDebugKotlin'

I’m just starting on enabling data binding by adding this code to my build.gradle (app) file:

apply plugin: 'kotlin-kapt'

android {
    dataBinding {
        enabled = true

But I’m getting this build error:

* What went wrong:
Execution failed for task ':app:kaptDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution
   > java.lang.reflect.InvocationTargetException (no error message)

According to stack trace:
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException

Okay, looks like I should downgrade JDK from 11 to 8. Fixed this issue when using JDK8.

how do you down grade to jdk 8 from 11?

i should down grade now.

Had the same problem but it was solved when I changed the “build.gradle” file from buildscript.ext.kotlin_version=“1.4.21” to “1.3.21”, which is what is in the data package for the book.