Mapbox Version
default
React Native Version
0.86.0
Platform
Android
@rnmapbox/maps version
10.3.2
Standalone component to reproduce
This is a build-time (Gradle) failure, not a runtime/JS issue, so it can't be reproduced with a standalone component. It reproduces from configuration alone:
- A React Native 0.86 app with the New Architecture enabled (Gradle 8.14.3 / AGP 8.9+).
@rnmapbox/maps@10.3.2 added as a dependency.
cd android && ./gradlew :rnmapbox_maps:compileDebugKotlin (or a full app build).
Minimal android/build.gradle (app) relevant bits:
// gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
// AGP resolved via the RN 0.86 gradle plugin (8.9+)
Observed behavior and steps to reproduce
Building the Android app fails with unresolved-reference errors for symbols defined under android/src/main/mapbox-v11-compat/v11 and android/src/main/rn-compat/rn75 (e.g. the com.rnmapbox.rnmbx.v11compat and com.rnmapbox.rnmbx.rncompat packages).
Steps:
- Use RN 0.86 (New Arch) → Gradle 8.14.3 / AGP 8.9+.
- Install
@rnmapbox/maps@10.3.2.
- Build the Android app (or run
:rnmapbox_maps:compileDebugKotlin).
- Compilation fails because the
.kt files in the compat directories are never compiled.
Root cause: android/build.gradle registers those directories only via java.srcDirs +=. On AGP 8.9+, appending to java.srcDirs no longer implicitly adds the directory as a Kotlin source root for the compileKotlin task, so the .kt files there are silently skipped.
Expected behavior
- The Kotlin sources under
mapbox-v11-compat/* and rn-compat/* should be compiled on AGP 8.9+ (RN 0.86), the same as on older AGP versions.
- The Android build should succeed without a consumer-side patch.
Notes / preliminary analysis
The directories are added as Java source roots only:
java.srcDirs += 'src/main/mapbox-v11-compat/v11'
java.srcDirs += 'src/main/rn-compat/rn75'
but they contain .kt files. Registering them as Kotlin source dirs as well fixes it:
kotlin {
srcDir 'src/main/mapbox-v11-compat/v11'
srcDir 'src/main/rn-compat/rn75'
}
The same pattern is used for other mapbox-v11-compat / rn-compat variants in the file, so they likely need the same treatment. Confirmed working via a yarn patch on android/build.gradle.
Additional links and references
- AGP 8.9 release notes / changes to
sourceSets and Kotlin source handling.
- (Add your PR link here if you open one with the
kotlin { srcDir ... } fix.)
Mapbox Version
default
React Native Version
0.86.0
Platform
Android
@rnmapbox/mapsversion10.3.2
Standalone component to reproduce
This is a build-time (Gradle) failure, not a runtime/JS issue, so it can't be reproduced with a standalone component. It reproduces from configuration alone:
@rnmapbox/maps@10.3.2added as a dependency.cd android && ./gradlew :rnmapbox_maps:compileDebugKotlin(or a full app build).Minimal
android/build.gradle(app) relevant bits:Observed behavior and steps to reproduce
Building the Android app fails with unresolved-reference errors for symbols defined under
android/src/main/mapbox-v11-compat/v11andandroid/src/main/rn-compat/rn75(e.g. thecom.rnmapbox.rnmbx.v11compatandcom.rnmapbox.rnmbx.rncompatpackages).Steps:
@rnmapbox/maps@10.3.2.:rnmapbox_maps:compileDebugKotlin)..ktfiles in the compat directories are never compiled.Root cause:
android/build.gradleregisters those directories only viajava.srcDirs +=. On AGP 8.9+, appending tojava.srcDirsno longer implicitly adds the directory as a Kotlin source root for thecompileKotlintask, so the.ktfiles there are silently skipped.Expected behavior
mapbox-v11-compat/*andrn-compat/*should be compiled on AGP 8.9+ (RN 0.86), the same as on older AGP versions.Notes / preliminary analysis
The directories are added as Java source roots only:
but they contain
.ktfiles. Registering them as Kotlin source dirs as well fixes it:kotlin { srcDir 'src/main/mapbox-v11-compat/v11' srcDir 'src/main/rn-compat/rn75' }The same pattern is used for other
mapbox-v11-compat/rn-compatvariants in the file, so they likely need the same treatment. Confirmed working via ayarn patchonandroid/build.gradle.Additional links and references
sourceSetsand Kotlin source handling.kotlin { srcDir ... }fix.)