Execution failed for task ':app:kaptDebugKotlin'. >

Viewed 2733

Getting this error when making a build on Android Studio

Execution failed for task ':app:kaptDebugKotlin'.

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

4 Answers

Getting the same on the Apple M1 chip. Works on my intel. Very frustrating

I had same error I was using below code

implementation "android.arch.persistence.room:runtime:1.1.1"
kapt "android.arch.persistence.room:compiler:1.1.1"

I solved using dependency as below

def room_version = "2.4.1"
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-ktx:$room_version"

It's probably caused by room library as it happened to me before. Usually android studio gives more info about what's causing the error, you can check the build log and click on the parent error and it will give a hint to fix the problem.

If you are using Room please share your dao and entities so we can help.

It can be caused by many reasons but you can get more info about it by look into the parent error of "Execution failed for task ':app:kaptDebugKotlin'."

sometimes you have to scroll top to see the real failing build error

I faced the same problem.

I was using kapt annotation processor. Replacing with annotationProcessor solved my issue.

See here for details.

Related