본문 바로가기
Android/Kotlin

Caused by: org.gradle.api.GradleException: 'compileDebugJavaWithJavac' task (current target is 1.8) and 'kaptGenerateStubsDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.

by DnaJ 2023. 6. 16.
반응형

Android Studio 를 업데이트 하고 Gradle 업데이트를 하니 

아래와 같은 에러가 발생했다.

 

Caused by: org.gradle.api.GradleException: 'compileDebugJavaWithJavac' task (current target is 1.8) and 'kaptGenerateStubsDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.

 

compileOptions에서 JavaVersion 을 업데이트 하면 된다.

Gradle 파일에 따라 아래와 같이 수정하면 된다.

 

compileOptions.run {
    sourceCompatibility = JavaVersion.VERSION_17
    targetCompatibility = JavaVersion.VERSION_17
}

 

or

 

composeOptions {
    kotlinCompilerVersion = JavaVersion.VERSION_17
    kotlinCompilerExtensionVersion = JavaVersion.VERSION_17
}
반응형

댓글