mapbox-maps-android icon indicating copy to clipboard operation
mapbox-maps-android copied to clipboard

Map fails to load if bike lanes url is down

Open yousrasd opened this issue 6 months ago • 3 comments

Environment

  • Android OS version: 16
  • Devices affected: all
  • Maps SDK Version: 11.12.2

Observed behavior and steps to reproduce

  • Our app embeds bike lanes in the map style as a source, like this: "sources": { "bikeLanes": { "data": "https://bikeslanes.net/map/bike-lanes", "type": "geojson" } }

  • So Mapbox should fetch the bike lanes from the provided data URL.

We have noticed that on a fresh app install, while Mapbox is initializing the map, if the bike lanes URL is down, the entire map fails to load. Mapbox does not display the map.

Expected behavior

The map should still render. Just the bike lanes layer should not be visible.

Notes / preliminary analysis

  • iOS SDK seems to be more resilient, because the map does load on our iOS app if the bike lanes URL is down.

yousrasd avatar Jul 15 '25 18:07 yousrasd

We are experiencing same behaviour in the app

yandroidUA avatar Jul 15 '25 19:07 yandroidUA

@yousrasd Hi, can you provide any minimal reproduction code?

persidskiy avatar Jul 29 '25 13:07 persidskiy

@persidskiy

fun applyMapTheme(styleUrl: String) {
    // Skip if already using this style version
    if (currentStyleEtag == styleEtag) {
        return
    }

    // Set up error handling for style loading failures
    styleErrorObserver = mapboxMapView.mapboxMap.subscribeMapLoadingError { error ->
        logger.warn("Failed to load map style: ${error.message}")
    }

    // Load the new map style asynchronously
    mapboxMapView.mapboxMap.loadStyle(
        style = styleUrl,
        onStyleLoaded = { styleLoadComplete() }
    )
}

private fun styleLoadComplete() {
    // Process map style initialization
}

yousrasd avatar Aug 13 '25 15:08 yousrasd