Mapbox Version
default
React Native Version
0.86.0
Platform
Android
@rnmapbox/maps version
10.3.2
Standalone component to reproduce
import React from 'react';
import { View } from 'react-native';
import Mapbox, { MapView } from '@rnmapbox/maps';
Mapbox.setAccessToken('<YOUR_TOKEN>');
export default function App() {
// The failure is at Android build time (AGP 8.9+ / RN 0.86), not at runtime.
// Merely depending on @rnmapbox/maps@10.3.2 and building for Android
// reproduces it — this component just makes the dependency compile in.
return (
<View style={{ flex: 1 }}>
<MapView style={{ flex: 1 }} />
</View>
);
}
Observed behavior and steps to reproduce
Building the Android app fails to compile @rnmapbox/maps — unresolved-reference errors for the com.rnmapbox.rnmbx.v11compat and com.rnmapbox.rnmbx.rncompat packages (Kotlin sources under android/src/main/mapbox-v11-compat/v11 and android/src/main/rn-compat/rn75).
Steps:
- RN 0.86 app, New Architecture enabled → Gradle 8.14.3 / AGP 8.9+.
yarn add @rnmapbox/maps@10.3.2.
- Add the component above.
cd android && ./gradlew :rnmapbox_maps:compileDebugKotlin (or build the app).
- Kotlin compilation fails — the
.kt files in the compat dirs are never compiled.
Root cause: android/build.gradle registers those dirs only via java.srcDirs +=; on AGP 8.9+ that no longer adds them as Kotlin source roots for compileKotlin.
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 compat directories are added as Java source roots only, but they contain .kt files:
java.srcDirs += 'src/main/mapbox-v11-compat/v11'
java.srcDirs += 'src/main/rn-compat/rn75'
On AGP 8.9+, appending to java.srcDirs no longer implicitly registers the directory as a Kotlin source root for the compileKotlin task, so those .kt files are silently skipped.
Registering them as Kotlin source dirs as well fixes it:
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 java.srcDirs += 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.
Environment:
@rnmapbox/maps: 10.3.2
- React Native: 0.86.0 (New Architecture enabled)
- Gradle: 8.14.3 (AGP 8.9+)
- Package manager: Yarn 3.6.4
Additional links and references
- AGP 8.9 changes to
sourceSets / Kotlin source-set handling (source of the regression).
Mapbox Version
default
React Native Version
0.86.0
Platform
Android
@rnmapbox/mapsversion10.3.2
Standalone component to reproduce
Observed behavior and steps to reproduce
Building the Android app fails to compile
@rnmapbox/maps— unresolved-reference errors for thecom.rnmapbox.rnmbx.v11compatandcom.rnmapbox.rnmbx.rncompatpackages (Kotlin sources underandroid/src/main/mapbox-v11-compat/v11andandroid/src/main/rn-compat/rn75).Steps:
yarn add @rnmapbox/maps@10.3.2.cd android && ./gradlew :rnmapbox_maps:compileDebugKotlin(or build the app)..ktfiles in the compat dirs are never compiled.Root cause:
android/build.gradleregisters those dirs only viajava.srcDirs +=; on AGP 8.9+ that no longer adds them as Kotlin source roots forcompileKotlin.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 compat directories are added as Java source roots only, but they contain
.ktfiles:On AGP 8.9+, appending to
java.srcDirsno longer implicitly registers the directory as a Kotlin source root for thecompileKotlintask, so those.ktfiles are silently skipped.Registering them as Kotlin source dirs as well fixes it:
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
java.srcDirs +=pattern is used for othermapbox-v11-compat/rn-compatvariants in the file, so they likely need the same treatment. Confirmed working via ayarn patchonandroid/build.gradle.Environment:
@rnmapbox/maps: 10.3.2Additional links and references
sourceSets/ Kotlin source-set handling (source of the regression).