Skip to content

chore(Android): Remove explicit versions setting in build.gradle#4146

Merged
kkafar merged 5 commits into
mainfrom
@mbert/dont-pin-kotlin
Jul 7, 2026
Merged

chore(Android): Remove explicit versions setting in build.gradle#4146
kkafar merged 5 commits into
mainfrom
@mbert/dont-pin-kotlin

Conversation

@m-bert

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

Copy link
Copy Markdown
Contributor

Description

This PR is a follow up for the PR from Gesture Handler side. In this issue in our repository it was stated that there are warnings during build phase, namely both, Screens and Gesture Handler try to load their pinned versions of Kotlin.

Changes

To address aforementioned issue, I've added simple if statement that adds pinned versions to classpath only if Screens is the root project (e.g. when running spotless). Both, gradle and kotlin-gradle-plugin are shipped with React Native apps (see template) so it is not necessary to declare them. This could break before RN 0.70, but I don't think that it is relevant at this point.

Test plan

Tested that FabricExample and standalone app with Screens added from generated package build correctly.

Checklist

  • Included code example that can be used to test this change.
  • For visual changes, included screenshots / GIFs / recordings documenting the change.
  • For API changes, updated relevant public types.
  • Ensured that CI passes

Copilot AI review requested due to automatic review settings June 10, 2026 11:03

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

Updates the Android Gradle setup for react-native-screens to avoid pinning/buildscript classpath duplication when the library is consumed as a dependency, addressing build warnings about multiple Kotlin plugin versions being loaded.

Changes:

  • Wrapes buildscript classpath dependencies (AGP, Kotlin Gradle plugin, Spotless) so they’re only added when react-native-screens is the root Gradle project.
  • Leaves consumer apps to rely on their own (React Native-provided) Gradle/Kotlin plugin classpath versions.

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

Comment thread android/build.gradle Outdated
m-bert and others added 2 commits June 10, 2026 13:08
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@m-bert m-bert requested a review from kkafar June 10, 2026 12:37
@m-bert m-bert changed the title [Android] Remove explicit versions setting in build.gradle chore(Android): Remove explicit versions setting in build.gradle Jun 11, 2026
@kkafar kkafar self-assigned this Jul 7, 2026

@kkafar kkafar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems good, thank you!

@kkafar kkafar merged commit 6f38d76 into main Jul 7, 2026
5 of 6 checks passed
@kkafar kkafar deleted the @mbert/dont-pin-kotlin branch July 7, 2026 13:41
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.

3 participants