Skip to content

Commit a96cf17

Browse files
m-bertCopilot
andauthored
[Android] Do not set explicit versions in build.gradle (#4248)
## Description Gesture Handler loads specific Kotlin version during build. This is unnecessary and may cause build warnings, such as one described in #2307. This PR removes pinning of specific kotlin/gradle versions when Gesture Handler is not root project, so we fallback to the ones declared by the root. Unfortunately we can't simply remove those lines, as `spotless` would fail. Fixes #2307 ## Test plan Tested that android build correctly in basic-example, expo-example and standalone app. --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 510b066 commit a96cf17

3 files changed

Lines changed: 7 additions & 16 deletions

File tree

packages/docs-gesture-handler/docs/fundamentals/installation.mdx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,6 @@ export function CustomModal({ children, ...rest }) {
9191
}
9292
```
9393

94-
Gesture Handler on Android is implemented in Kotlin. If you need to set a specific Kotlin version to be used by the library, set the `kotlinVersion` ext property in the `android/build.gradle` file and RNGH will use that version:
95-
96-
```groovy
97-
buildscript {
98-
ext {
99-
kotlinVersion = "2.1.20"
100-
}
101-
}
102-
```
103-
10494
#### iOS
10595

10696
While developing for iOS, make sure to install [pods](https://cocoapods.org/) first before running the app:

packages/react-native-gesture-handler/android/build.gradle

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@ import groovy.json.JsonSlurper
22
import com.android.build.gradle.tasks.ExternalNativeBuildJsonTask
33

44
buildscript {
5-
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['RNGH_kotlinVersion']
6-
75
repositories {
86
mavenCentral()
97
google()
108
}
119

1210
dependencies {
13-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
14-
classpath("com.android.tools.build:gradle:8.10.1")
15-
classpath("com.diffplug.spotless:spotless-plugin-gradle:7.0.4")
11+
if (project == rootProject) {
12+
def kotlin_version = project.properties['RNGH_kotlinVersion']
13+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
14+
classpath("com.android.tools.build:gradle:8.10.1")
15+
classpath("com.diffplug.spotless:spotless-plugin-gradle:7.0.4")
16+
}
1617
}
1718
}
1819

packages/react-native-gesture-handler/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemor
1616
# This option should only be used with decoupled projects. More details, visit
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1818
# org.gradle.parallel=true
19-
RNGH_kotlinVersion=2.0.21
19+
RNGH_kotlinVersion=2.2.0

0 commit comments

Comments
 (0)