diff --git a/lib/android/app/build.gradle b/lib/android/app/build.gradle index 93e918795d2..397e08cb3c9 100644 --- a/lib/android/app/build.gradle +++ b/lib/android/app/build.gradle @@ -66,7 +66,11 @@ android { targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { - jvmTarget = JavaVersion.VERSION_17 + if (reactNativeMinorVersion() >= 73) { + jvmTarget = JavaVersion.VERSION_17 + } else { + jvmTarget = JavaVersion.VERSION_11 + } } flavorDimensions "RNN.reactNativeVersion" @@ -110,6 +114,9 @@ android { reactNative71 { dimension "RNN.reactNativeVersion" buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "71") + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17 + } } } @@ -122,6 +129,11 @@ android { } } +int reactNativeMinorVersion() { + List reactNativeVersionComponents = reactNativeVersionComponents(findReactNativePackageJson()) + reactNativeVersionComponents[1].toInteger() +} + String resolveFlavor() { List reactNativeVersionComponents = reactNativeVersionComponents(findReactNativePackageJson()) Integer reactNativeMinorComponent = reactNativeVersionComponents[1].toInteger()