How to fix 'Execution failed for task ':app:compileDebugKotlin'' | jvm target compatibility error.

preview_player
Показать описание
Solution for Kotlin project compilation error "Execution failed for task ':app:compileDebugKotlin'".
'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.

Solution:-
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}

#java
#kotlin
#androidstudio
Рекомендации по теме
Комментарии
Автор

Really Thanks!!!! i aproximately spend time 8 hours ...but didnt fix this error...i watch many videos ...i didn't solve it...but i watch your video onetime ...this error easy to solve it...again thanks

Guruprakashc
Автор

Thank you very much, it took me 6 hours before I finally found this video

rizkydipahiyata
Автор

It's interesting because your version of Studio has a Gradle Version and Gradle Plugin Version whereas mine does not. So I had no shortcut. I have needed to create a new project and take all my files across to the new project. It seems to be a design fault with Studio and a reason why a new version of Studio would come out -- so that settings for switching the Gradle Version etc. could be included. Thank you for this content and for trying to assist 😊... Also, I tried your latter solution which would've been perfect, but the same error message appears. It seems to mean that despite the setting-adjustments, that there is an underlying reliance on the 1.8 that keeps coming up.

mmathems
Автор

Thanks again, you saved me twice in 1 day

stihl
Автор

thank you very much i spent nearly 10 - 12hrs

puneethas
Автор

what about those dont have options for Android Gradle Plugin version using Jellyfish Android studio

iswarrand.sivaraj
Автор

> 'compileDebugJavaWithJavac' task (current target is 1.8) and task (current target is 18) jvm target compatibility should be set to the same Java version. always show error

fewcwpb
Автор

Thank you my life saviour!!
However, I find it is quite weird that by default my build gradle setting has set both to java version 1.8 but it still throws errors.
When changing them to version 17 then it resolved.

ShirakumoYuu
Автор

thank you mam and God bless you every time and a lot of love from pakistan

Hindijanta-blls
Автор

mine is Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (1.8) and 'compileDebugKotlin' (17).

PercyMelody
Автор

Runtime issues when interoperability of a static method from a kotlin class says class not found, can u take this

prasuguna
Автор

does anyone know how to fix this Execution failed for task

mahmoudlubbad
Автор

Execution failed for task ':app:kaptDebugKotlin'. Please can give the solution for this error. I've been searching everywhere, couldn't find the solution.

manukm
Автор

':test:compilekotlin' . 'compilejava' task (current target is 1.7) and 'compilekotlin' task (current target is 17) pls help 😢

kqfdmfp
Автор

Hello....Can anyone help?
I am getting the following error but I don't know what to do. I'm not a programmer and if someone answers please write me the exact steps

* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> A failure occurred while executing
> Compilation error. See log for more details

charischaris