Skip to content

[Android] Do not set explicit versions in build.gradle #4248

Open
m-bert wants to merge 7 commits into
mainfrom
@mbert/dont-pin-kotlin
Open

[Android] Do not set explicit versions in build.gradle #4248
m-bert wants to merge 7 commits into
mainfrom
@mbert/dont-pin-kotlin

Conversation

@m-bert

@m-bert m-bert commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

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.

Copilot AI review requested due to automatic review settings June 9, 2026 13:32
}
```

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:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we want to remove it entirely, or add info that it is not supported anymore (e.g. starting from 3.1.0)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces Android build warnings about the Kotlin Gradle plugin being loaded multiple times by avoiding adding an explicit kotlin-gradle-plugin classpath dependency when the root project already provides it. It also updates the installation docs to remove guidance about forcing a specific Kotlin version for RNGH.

Changes:

  • Conditionally adds org.jetbrains.kotlin:kotlin-gradle-plugin to the buildscript classpath only when the root project does not already include it.
  • Removes the documentation section describing how to override RNGH’s Kotlin version via ext.kotlinVersion.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/react-native-gesture-handler/android/build.gradle Adds a root-project classpath check to avoid explicitly loading the Kotlin Gradle plugin when it’s already provided.
packages/docs-gesture-handler/docs/fundamentals/installation.mdx Removes Kotlin-version override instructions from the Android installation docs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/react-native-gesture-handler/android/build.gradle Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@m-bert m-bert changed the title [Android] Do not set explicit Kotlin version in build.gradle [Android] Do not set explicit versions in build.gradle Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android] The Kotlin Gradle plugin was loaded multiple times in different subprojects

2 participants