From 9c658317dbe9de4e3e3da67eda6f5f43d466fe54 Mon Sep 17 00:00:00 2001 From: Alex Risch Date: Wed, 10 Jan 2024 13:15:53 -0700 Subject: [PATCH] feat: Added support for Java 17 Fix issue: > 'compileDebugJavaWithJavac' task (current target is 17) and 'compileDebugKotlin' task (current target is 11) jvm target compatibility should be set to the same Java version. Seen when working with React Native 0.73 project Bumped compile sdk to 34 --- android/build.gradle | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index bdfb96053..121aaac24 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -66,15 +66,18 @@ afterEvaluate { } android { - compileSdkVersion safeExtGet("compileSdkVersion", 31) + compileSdkVersion safeExtGet("compileSdkVersion", 34) - compileOptions { - sourceCompatibility JavaVersion.VERSION_11 - targetCompatibility JavaVersion.VERSION_11 - } + def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION + if (agpVersion.tokenize('.')[0].toInteger() < 8) { + compileOptions { + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 + } - kotlinOptions { - jvmTarget = JavaVersion.VERSION_11.majorVersion + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.majorVersion + } } defaultConfig {