A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution > java.lang.reflect.InvocationTargetException (no error message)

Android Studio's UI was just hiding the error...

when the error occurred, it highlighted the item in the list view, and showed an unhelpful message in the terminal view. unhelpful error message appears when erroneous item is selected

to find the real error, select the root item in the list view so that Android Studio would display the whole build output in the terminal view, then scroll to find error. helpful error message appars when you select the root item from the list view on the left


This exception occurs when you have done some mistake on Room database or Doa or entity class for example I had done mistakes in the entity class

  1. I had made the autogenerated field of Entity class val instead of var
  2. I had put delete annotation on two functions with a different name but they were deleting the same data

so I would suggest to check the entity,dao or database class carefully if you imported the right dependency.

@Entity(tableName = "user_table")
data class User(
    val firstName: String,
    val lastName: String,
    val age: Int
) {
    @PrimaryKey(autoGenerate = true)
    var id: Int = 0 //**do not made it val**
}

You need change:

kapt "android.arch.persistence.room:compiler:$room_version"

to

kapt "androidx.room:room-compiler:$room_version"