I'm trying to follow the suggestions from <this bl...
# community-support
n
I'm trying to follow the suggestions from this blogpost and set a
-jdk-release
value but I'm running into an error message
e: JDK_HOME path is not specified in compiler configuration
🧵
This is my build file in a a small reproducer (I can share the full code if necessary)
Copy code
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
    alias(libs.plugins.android.application)
    alias(libs.plugins.jetbrains.kotlin.android)
}

android {
    namespace = "dev.whosnickdoglio.issue"
    compileSdk = 34

    defaultConfig {
        applicationId = "dev.whosnickdoglio.issue"
        minSdk = 24
        targetSdk = 34
        versionCode = 1
        versionName = "1.0"
        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary = true
        }
    }

    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "<http://proguard-rules.pro|proguard-rules.pro>"
            )
        }
    }
    buildFeatures {
        compose = true
    }
    composeOptions {
        kotlinCompilerExtensionVersion = "1.5.11"
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }
    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_11.toString()
    }
}

kotlin { jvmToolchain(20) }

tasks.withType(KotlinCompile::class).configureEach {
    compilerOptions {
        jvmTarget.set(JvmTarget.JVM_11)
        freeCompilerArgs.add("-Xjdk-release=11")
    }
}

dependencies {
    implementation(libs.androidx.core.ktx)
    implementation(libs.androidx.lifecycle.runtime.ktx)
    implementation(libs.androidx.activity.compose)
    implementation(platform(libs.androidx.compose.bom))
    implementation(libs.androidx.ui)
    implementation(libs.androidx.ui.graphics)
    implementation(libs.androidx.material3)
}
t
Note that, from the blog post:
Users of the Kotlin Android plugin or the Android targets of the Kotlin multiplatform plugin do not need to do this, as the use of the
android.jar
as the boot classpath limits the
java.*
APIs to those of your
compileSdk
(and Android Lint ensures you don’t use anything newer than your
minSdk
).
n
AH thanks I'm not sure how I missed that, thanks Thomas!