Mapbox Version
default
React Native Version
0.86.0
Platform
Android
@rnmapbox/maps version
10.3.2
Standalone component to reproduce
Summary
On AGP 8.9+ (pulled in by React Native 0.86 / Gradle 8.x), the Kotlin sources under android/src/main/mapbox-v11-compat/v11 and android/src/main/rn-compat/rn75 are silently excluded from compilation. android/build.gradle registers these directories only via java.srcDirs, and AGP 8.9+ no longer feeds extra java.srcDirs into the Kotlin compile task. The result is unresolved-reference build errors for the v11compat and rncompat packages.
Environment
@rnmapbox/maps: 10.3.2
- React Native: 0.86.0 (New Architecture enabled)
- Gradle: 8.14.3 (AGP 8.9+)
- Kotlin Gradle Plugin: (AGP-bundled)
Current code
android/build.gradle:
sourceSets {
main {
java.srcDirs = ['src/main/java']
java.srcDirs += 'src/main/mapbox-v11-compat/v11'
java.srcDirs += 'src/main/rn-compat/rn75'
...
}
}
Both appended directories contain .kt files (e.g. mapbox-v11-compat/v11/.../MapboxMap.kt, OfflineManager.kt; rn-compat/rn75/.../Dynamic.kt, ReadableMap.kt).
Root cause
With AGP 8.9+, appending a directory to java.srcDirs no longer implicitly adds it as a Kotlin source root for the compileKotlin task. The .kt files above are therefore never compiled, and any consumer of those packages fails to resolve.
Suggested fix
Also register the directories as Kotlin source dirs:
sourceSets {
main {
java.srcDirs = ['src/main/java']
java.srcDirs += 'src/main/mapbox-v11-compat/v11'
java.srcDirs += 'src/main/rn-compat/rn75'
kotlin {
srcDir 'src/main/mapbox-v11-compat/v11'
srcDir 'src/main/rn-compat/rn75'
}
...
}
}
(The same likely applies to any other mapbox-v11-compat / rn-compat variant selected for a different RN/Mapbox combination.)
Workaround
Patching android/build.gradle with the kotlin { srcDir ... } block above (via yarn patch / patch-package) resolves the build for us on RN 0.86.
Observed behavior and steps to reproduce
No response
Expected behavior
No response
Notes / preliminary analysis
No response
Additional links and references
No response
Mapbox Version
default
React Native Version
0.86.0
Platform
Android
@rnmapbox/mapsversion10.3.2
Standalone component to reproduce
Summary
On AGP 8.9+ (pulled in by React Native 0.86 / Gradle 8.x), the Kotlin sources under
android/src/main/mapbox-v11-compat/v11andandroid/src/main/rn-compat/rn75are silently excluded from compilation.android/build.gradleregisters these directories only viajava.srcDirs, and AGP 8.9+ no longer feeds extrajava.srcDirsinto the Kotlin compile task. The result is unresolved-reference build errors for thev11compatandrncompatpackages.Environment
@rnmapbox/maps: 10.3.2Current code
android/build.gradle:sourceSets { main { java.srcDirs = ['src/main/java'] java.srcDirs += 'src/main/mapbox-v11-compat/v11' java.srcDirs += 'src/main/rn-compat/rn75' ... } }Both appended directories contain
.ktfiles (e.g.mapbox-v11-compat/v11/.../MapboxMap.kt,OfflineManager.kt;rn-compat/rn75/.../Dynamic.kt,ReadableMap.kt).Root cause
With AGP 8.9+, appending a directory to
java.srcDirsno longer implicitly adds it as a Kotlin source root for thecompileKotlintask. The.ktfiles above are therefore never compiled, and any consumer of those packages fails to resolve.Suggested fix
Also register the directories as Kotlin source dirs:
sourceSets { main { java.srcDirs = ['src/main/java'] java.srcDirs += 'src/main/mapbox-v11-compat/v11' java.srcDirs += 'src/main/rn-compat/rn75' kotlin { srcDir 'src/main/mapbox-v11-compat/v11' srcDir 'src/main/rn-compat/rn75' } ... } }(The same likely applies to any other
mapbox-v11-compat/rn-compatvariant selected for a different RN/Mapbox combination.)Workaround
Patching
android/build.gradlewith thekotlin { srcDir ... }block above (viayarn patch/ patch-package) resolves the build for us on RN 0.86.Observed behavior and steps to reproduce
No response
Expected behavior
No response
Notes / preliminary analysis
No response
Additional links and references
No response