Skip to content

Commit 7d88236

Browse files
authored
fix(android): use kotlinVersion to determine default corutines version (#3481)
1 parent 9a9bc35 commit 7d88236

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

android/build.gradle

+14-4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ def isNewArchitectureEnabled() {
1313
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
1414
}
1515

16+
17+
def getKotlinVersion() {
18+
return rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : '1.6.21'
19+
}
20+
21+
def getCoroutinesVersion(kotlinVersion) {
22+
return kotlinVersion >= '1.9' ? '1.8.0' : '1.6.4'
23+
}
24+
1625
// expo plugin
1726
if (rootProject.ext.has('expoRNMapboxMapsImpl')) {
1827
rootProject.ext.set('RNMapboxMapsImpl', rootProject.ext.get('expoRNMapboxMapsImpl'))
@@ -21,15 +30,17 @@ if (rootProject.ext.has('expoRNMapboxMapsVersion')) {
2130
rootProject.ext.set('RNMapboxMapsVersion', rootProject.ext.get('expoRNMapboxMapsVersion'))
2231
}
2332

33+
project.ext.set("kotlinVersion", getKotlinVersion())
2434

2535
buildscript {
2636
repositories {
2737
google()
2838
mavenCentral()
2939
}
3040

41+
def kotlinVersion = this.kotlinVersion
3142
dependencies {
32-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : '1.6.21'}"
43+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
3344
}
3445
}
3546

@@ -142,9 +153,8 @@ dependencies {
142153
// React Native
143154
implementation "com.facebook.react:react-native:+"
144155

145-
// kotlin coroutines
146-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${safeExtGet('kotlinxCoroutinesCoreVersion', '1.8.0')}"
147-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${safeExtGet('kotlinxCoroutinesAndroidVersion', '1.8.0')}"
156+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${safeExtGet('kotlinxCoroutinesCoreVersion', getCoroutinesVersion(getKotlinVersion()))}"
157+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${safeExtGet('kotlinxCoroutinesAndroidVersion', getCoroutinesVersion(getKotlinVersion()))}"
148158

149159
// Mapbox SDK
150160
customizableDependencies('RNMapboxMapsLibs') {

0 commit comments

Comments
 (0)