Android Studio build error: incompatibility of target Java 1.8 and 17 in kapt
Hello everyone! I'm a beginner in Android development with Kotlin, and when building a project in Android Studio I got an error that I can't fix. Here's what Gradle says:
```
Execution failed for task ':app:kaptGenerateStubsDebugKotlin'.
> 'compileDebugJavaWithJavac' task (current target is 1.8) and 'kaptGenerateStubsDebugKotlin' task (current target is 17) have different JVM target compatibility.
```
I'm using Kotlin 1.9.0, Android Gradle Plugin 8.1.0, compileSdk 34, targetSdk 34. In my `build.gradle.kts` (module level) I explicitly set `compileOptions` with `sourceCompatibility = JavaVersion.VERSION_1_8` and `targetCompatibility = JavaVersion.VERSION_1_8` because I read that this is needed for compatibility with old libraries. Here's the code snippet:
```kotlin
android {
co
```
No answers yet.
Log in to leave an answer