From fef0e02a4d3219cf1b0ab73d649494742ab6f491 Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Fri, 17 Oct 2025 16:25:51 +0800 Subject: [PATCH] Specify JDK toolchain directly Specifying JDK toolchain in the java block lets us avoid specifying same version again and again for different options while ensuring everything is on the same version Ref: https://developer.android.com/build/jdks#toolchain Signed-off-by: Aayush Gupta --- app/build.gradle.kts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index e4c186e50..037c3cb53 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -18,6 +18,12 @@ val gitWorkingBranch = providers.exec { commandLine("git", "rev-parse", "--abbrev-ref", "HEAD") }.standardOutput.asText.map { it.trim() } +java { + toolchain { + languageVersion = JavaLanguageVersion.of(17) + } +} + android { compileSdk = 36 namespace = "org.schabi.newpipe" @@ -87,16 +93,9 @@ android { compileOptions { // Flag to enable support for the new language APIs isCoreLibraryDesugaringEnabled = true - - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 encoding = "utf-8" } - kotlinOptions { - jvmTarget = "17" - } - sourceSets { getByName("androidTest") { assets.srcDir("$projectDir/schemas")