Hello,
chapter 12 in the end of section “Querying the Database” we asked for run the app.
while I’m start running the app i get an error:
"Execution failed for task ‘:app:kaptGenerateStubsDebugKotlin’.
‘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.
Consider using JVM toolchain: Configure a Gradle project | Kotlin Documentation"
and after a week that i tried to solved that with no success i want to ask you guys If anyone comes across this problem?
If so, how are you solved that?
this is my build.gradle file (app level):
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("org.jetbrains.kotlin.kapt")
}
android {
namespace = "com.example.criminalIntent3"
compileSdk = 33
defaultConfig {
applicationId = "com.example.criminalIntent3"
minSdk = 21
targetSdk = 33
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
viewBinding = true
}
}
dependencies {
implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.9.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.lifecycle:lifecycle-extensions:2.0.0")
implementation("androidx.recyclerview:recyclerview:1.2.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.4.0")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0")
implementation("androidx.room:room-runtime:2.4.2")
implementation("androidx.room:room-ktx:2.4.2")
kapt("androidx.room:room-compiler:2.4.2")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
}
Thanks