From 34b3d0d8d9a5253c868594faab48d915886b8bfa Mon Sep 17 00:00:00 2001 From: Sharjeel Yunus <61178058+sharjeelyunus@users.noreply.github.com> Date: Mon, 23 Dec 2024 05:42:24 +0500 Subject: [PATCH] fix: android compile issue --- starter/android/build.gradle | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/starter/android/build.gradle b/starter/android/build.gradle index 5bcda9e35..fff94a155 100644 --- a/starter/android/build.gradle +++ b/starter/android/build.gradle @@ -20,12 +20,35 @@ allprojects { rootProject.buildDir = '../build' subprojects { + afterEvaluate { project -> + if (project.extensions.findByName("android") != null) { + Integer pluginCompileSdk = project.android.compileSdk + if (pluginCompileSdk != null && pluginCompileSdk < 34) { + + def javaVersion = JavaVersion.VERSION_17 + project.android { + compileSdk 34 + if (namespace == null) { + namespace project.group + } + compileOptions { + sourceCompatibility javaVersion + targetCompatibility javaVersion + } + tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { + kotlinOptions { + jvmTarget = javaVersion.toString() + } + } + } + } + } + } + project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') + project.evaluationDependsOn(":app") } tasks.register("clean", Delete) { delete rootProject.buildDir -} \ No newline at end of file +}