fix(android): register compat Kotlin source dirs for AGP 8.9+ (RN 0.86) - #4264
Open
joaquinvaz wants to merge 1 commit into
Open
fix(android): register compat Kotlin source dirs for AGP 8.9+ (RN 0.86)#4264joaquinvaz wants to merge 1 commit into
joaquinvaz wants to merge 1 commit into
Conversation
AGP 8.9+ (bundled with RN 0.86 / Gradle 8.x) no longer feeds extra java.srcDirs into the Kotlin compile task. The compat directories added to java.srcDirs (mapbox-v11-compat, rn-compat and the selected lifecycle-compat variant) contain only Kotlin sources, so they were silently skipped and their packages (e.g. com.rnmapbox.rnmbx.v11compat) failed to resolve, breaking the Android build. Mirror those directories onto the Kotlin source set. Guarded by the same RNMapboxMapsImpl == "mapbox" check as the kotlin-android plugin, since only that impl registers the `kotlin` source set.
joaquinvaz
had a problem deploying
to
CI with Mapbox Tokens
July 22, 2026 15:25 — with
GitHub Actions
Failure
joaquinvaz
had a problem deploying
to
CI with Mapbox Tokens
July 22, 2026 15:25 — with
GitHub Actions
Failure
joaquinvaz
had a problem deploying
to
CI with Mapbox Tokens
July 22, 2026 15:25 — with
GitHub Actions
Failure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #4263
On the React Native 0.86 Android toolchain, appending a directory to
java.srcDirsinandroid/build.gradleno longer registers it as a Kotlin source root for thecompileKotlintask. The compat directories added there —mapbox-v11-compat/v11,rn-compat/rn75, and the selectedlifecycle-compat/*variant — contain only Kotlin sources, so they are silently skipped and their packages (e.g.com.rnmapbox.rnmbx.v11compat) fail to resolve, breaking the Android build.Fix: after all the conditional
java.srcDirs +=additions, mirror them onto the Kotlin source set:One placement covers every current and future compat dir.
.github/REPRODUCING.md)I want to be upfront rather than overclaim:
/exampleas-is: it's pinned to RN 0.84.1 (Gradle 9.0.0 / AGP 8.9+) and builds fine there — including inandroid-actions.ymlCI. So this is not a plain "AGP 8.9+" bug; the trigger is the RN 0.86 toolchain specifically (its AGP + Kotlin Gradle Plugin combination). Reproducing in/examplewould require bumping it to RN 0.86.yarn patchtoandroid/build.gradle) is what made the Android build succeed. Without it: unresolved references to thev11compat/rncompatpackages. With it: clean compile.