diff --git a/android/build.gradle b/android/build.gradle index a128d2b2..c6d3e99a 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -2,14 +2,14 @@ import groovy.xml.XmlParser import org.jetbrains.kotlin.gradle.tasks.KotlinCompile buildscript { - ext.kotlin_version = '1.9.0' + ext.kotlin_version = '1.9.22' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.2.0' + classpath 'com.android.tools.build:gradle:8.1.4' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -19,11 +19,6 @@ allprojects { google() mavenCentral() } - tasks.withType(KotlinCompile).configureEach { - kotlinOptions { - jvmTarget = "17" - } - } } rootProject.layout.buildDirectory = '../build' @@ -37,6 +32,15 @@ subprojects { def manifest = new XmlParser().parse(file(it.android.sourceSets.main.manifest.srcFile)) android.namespace= manifest.@package } + tasks.withType(KotlinCompile).tap { + configureEach { + if (project.plugins.hasPlugin("com.android.application") || project.plugins.hasPlugin("com.android.library")) { + kotlinOptions.jvmTarget = android.compileOptions.sourceCompatibility + } else { + kotlinOptions.jvmTarget = sourceCompatibility + } + } + } } project.evaluationDependsOn(':app') }