Skip to content

Commit 7d39ba4

Browse files
committed
Added java 11 backward compatibility
1 parent 4408006 commit 7d39ba4

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/android/app/build.gradle

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ android {
6666
targetCompatibility JavaVersion.VERSION_1_8
6767
}
6868
kotlinOptions {
69-
jvmTarget = JavaVersion.VERSION_17
69+
if (reactNativeMinorVersion() >= 73) {
70+
jvmTarget = JavaVersion.VERSION_17
71+
} else {
72+
jvmTarget = JavaVersion.VERSION_11
73+
}
7074
}
7175

7276
flavorDimensions "RNN.reactNativeVersion"
@@ -110,6 +114,9 @@ android {
110114
reactNative71 {
111115
dimension "RNN.reactNativeVersion"
112116
buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "71")
117+
kotlinOptions {
118+
jvmTarget = JavaVersion.VERSION_17
119+
}
113120
}
114121
}
115122

@@ -122,6 +129,11 @@ android {
122129
}
123130
}
124131

132+
int reactNativeMinorVersion() {
133+
List reactNativeVersionComponents = reactNativeVersionComponents(findReactNativePackageJson())
134+
reactNativeVersionComponents[1].toInteger()
135+
}
136+
125137
String resolveFlavor() {
126138
List reactNativeVersionComponents = reactNativeVersionComponents(findReactNativePackageJson())
127139
Integer reactNativeMinorComponent = reactNativeVersionComponents[1].toInteger()

0 commit comments

Comments
 (0)