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

🐛 Android is exploding - GL error 0x501 - Flutter 3.22.0

Open tempo-riz opened this issue 1 year ago • 7 comments

Android emulator produce several annoying behaviors :

  • app stuck in white screen

  • dark blue background instead of the map

  • freeze/ heavy lags/fps drops

  • flutter 3.22.0

  • Android emulator api 34,

logs : E/emuglGLESv2_enc( 2463): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glGetStringi:4973 GL error 0x501

My guess is that it has something to do with flutter latest version where they touched/optimized their rendering stuff

tempo-riz avatar May 23 '24 13:05 tempo-riz

when is this error fixed??? map is blank doesnt work. same error i am getting

ember11498 avatar Jun 06 '24 19:06 ember11498

Similar error when load mapbox_maps_flutter, with background blue screen. First time loads the app, works fine, but when you try to reload.

  • app stuck in white screen
  • dark blue background instead of the map
  • freeze/ heavy lags/fps drops
  • flutter 3.22.0
  • Android emulator api 35,

If you uninstall the app and install again happens the same, first time works, then, when you reload the map you get the blue background.

logs: E/emuglGLESv2_enc( 5823): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glGetUniformLocation:2206 GL error 0x502

pablocabog avatar Jul 01 '24 06:07 pablocabog

Just tried Android app on both Emulator and physical device (Pixel 6a - Android 14) using the downloaded git repo example. Although the GL error does not seem to appear on physical device (it does in the emulator) the map does not work correctly.

Tried the Draw geoJson Line option and the redline draws first (briefly) with no map showing then disappears and the map is shown, but not line.

This is the same with a production app that did work, so currently this is broken on Android 👎🏼 and is unable to show routes on a map.

Caveat - not looked at any of the other options in the example app as we currently use Mapbox to display routes (or more correctly we did)

magnatronus avatar Jul 31 '24 07:07 magnatronus

So we can only wait the MapBox team to fix issue and update the new version in the future for further using

tuyen3962 avatar Jul 31 '24 07:07 tuyen3962

So I have managed to get round the issue I mentioned above. It seemed to me it was some form of timing issue as the GeoJson line was being drawn then overwritten by the map as it loads. To get round this I updated the example code for the geojson_line.dart file as detailed below. Now the line is (I think) only drawn after the map has loaded.

Basically I changed _onMapCreated to only track the controller, then moved the line code into a new onMapLoadedListener method.

  _onMapLoaded(mapLoadedEventData) async {
    var data = await rootBundle
        .loadString('assets/from_crema_to_council_crest.geojson');
    if (mapboxMap != null) {
      await mapboxMap!.style.addSource(GeoJsonSource(id: "line", data: data));
      await mapboxMap!.style.addLayer(LineLayer(
          id: "line_layer",
          sourceId: "line",
          lineJoin: LineJoin.ROUND,
          lineCap: LineCap.ROUND,
          lineColor: Colors.red.value,
          lineWidth: 6.0));
    }
  }

  _onMapCreated(MapboxMap mapboxMap) async {
    this.mapboxMap = mapboxMap;
  }

@override
  Widget build(BuildContext context) {
    return new Scaffold(
        body: MapWidget(
      key: ValueKey("mapWidget"),
      styleUri: MapboxStyles.MAPBOX_STREETS,
      cameraOptions: CameraOptions(
          center: Point(coordinates: Position(-122.486052, 37.830348)),
          zoom: 14.0),
      onMapCreated: _onMapCreated,
      onMapLoadedListener: _onMapLoaded,
    ));
  }

anyway works OK for what I need to do so I thought I would pass on what I have done.

magnatronus avatar Jul 31 '24 11:07 magnatronus

@magnatronus' work around allowed me to continue with my project (thank you magnatronus!!!) , but please help fix this. Several of the example project maps in the github repository don't work properly due to this error. I spend a week trying to debug this before I stumbled onto this bug report.

soldemeyer avatar Aug 10 '24 23:08 soldemeyer

@magnatronus - Thanks for the solution but PLEASE update the demo in the Git repo. Like @soldemeyer, I spent hours working on this. The code in the repo failed to ever draw a line on my Android test phone and this works perfectly.

noforeignland avatar Aug 15 '24 14:08 noforeignland