Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Adding symbol layer fails #968

Closed
AAverin opened this issue Mar 24, 2022 · 21 comments · Fixed by #969
Closed

[Android] Adding symbol layer fails #968

AAverin opened this issue Mar 24, 2022 · 21 comments · Fixed by #969

Comments

@AAverin
Copy link
Contributor

AAverin commented Mar 24, 2022

Adding symbol layer fails with exception when location was enabled.
Map is configured with:

MapboxMap(
  ...
  compassEnabled: true,
  myLocationEnabled: true,
  myLocationRenderMode: MyLocationRenderMode.COMPASS,
  myLocationTrackingMode: MyLocationTrackingMode.None,
  ...
)
I/flutter (32425): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter (32425): │ PlatformException(error, Could not find layer: mapbox-location-bearing-layer, null, com.mapbox.mapboxsdk.style.layers.CannotAddLayerException: Could not find layer: mapbox-location-bearing-layer
I/flutter (32425): │ 	at com.mapbox.mapboxsdk.maps.NativeMapView.nativeAddLayerAbove(Native Method)
I/flutter (32425): │ 	at com.mapbox.mapboxsdk.maps.NativeMapView.addLayerAbove(NativeMapView.java:874)
I/flutter (32425): │ 	at com.mapbox.mapboxsdk.maps.Style.addLayerAbove(Style.java:215)
I/flutter (32425): │ 	at com.mapbox.mapboxsdk.location.LocationComponentPositionManager.addLayerToMap(LocationComponentPositionManager.java:41)
I/flutter (32425): │ 	at com.mapbox.mapboxsdk.location.SymbolLocationLayerRenderer.addLayers(SymbolLocationLayerRenderer.java:90)
I/flutter (32425): │ 	at com.mapbox.mapboxsdk.location.LocationLayerController.applyStyle(LocationLayerController.java:95)
I/flutter (32425): │ 	at com.mapbox.mapboxsdk.location.LocationComponent.applyStyle(LocationComponent.java:762)
I/flutter (32425): │ 	at com.mapbox.mapboxgl.MapboxMapController.updateLocationLocationComponentLayer(MapboxMapController.java:286)
I/flutter (32425): │ 	at com.mapbox.mapboxgl.MapboxMapController.onMethodCall(MapboxMapController.java:825)
I/flutter (32425): │ 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
I/flutter (32425): │ 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:296)
I/flutter (32425): │ 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:320)
I/flutter (32425): │ 	at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$TsixYUB5E6FpKhMtCSQVHKE89gQ.run(Unknown Source:12)
I/flutter (32425): │ 	at android.os.Handler.handleCallback(Handler.java:873)
I/flutter (32425): │ 	at android.os.Handler.dispatchMessage(Handler.java:99)
I/flutter (32425): │ 	at android.os.Looper.loop(Looper.java:193)
I/flutter (32425): │ 	at android.app.ActivityThread.main(ActivityThread.java:6718)
I/flutter (32425): │ 	at java.lang.reflect.Method.invoke(Native Method)
I/flutter (32425): │ 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491)
I/flutter (32425): │ 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
I/flutter (32425): │ )
I/flutter (32425): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter (32425): │ #0   StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
I/flutter (32425): │ #1   MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:177:18)
I/flutter (32425): │ #2   <asynchronous suspension>
I/flutter (32425): │ #3   MethodChannelMapboxGl.addSymbolLayer (package:mapbox_gl_platform_interface/src/method_channel_mapbox_gl.dart:528:5)
I/flutter (32425): │ #4   <asynchronous suspension>
I/flutter (32425): │ #5   MapboxMapController.addSymbolLayer (package:mapbox_gl/src/controller.dart:346:5)
I/flutter (32425): │ #6   <asynchronous suspension>
@felix-ht
Copy link
Collaborator

felix-ht commented Mar 24, 2022

so you was myLocationEnabled true at first but later got set to false? And if you add a new layer after this change you get the error? Or did you change the permissions on the android side?

@AAverin
Copy link
Contributor Author

AAverin commented Mar 24, 2022

What seems to happen now is even if I start with location permission given and set myLocationEnabled = true, adding a symbol layer for geojson icons I get this exception

@felix-ht
Copy link
Collaborator

@AAverin without changing either?

@felix-ht
Copy link
Collaborator

can you try setting myLocationRenderMode to MyLocationRenderMode.GPS?

@AAverin
Copy link
Contributor Author

AAverin commented Mar 24, 2022

    return Scaffold(
        extendBodyBehindAppBar: true,
        body: FutureBuilder<PermissionStatus>(
            future: Permission.locationWhenInUse.request(),
            builder: (context, permissionsSnapshot) {
              if (permissionsSnapshot.connectionState != ConnectionState.done) {
                return Center(
                  child: CircularProgressIndicator(),
                );
              }

  
              return Container(
                MapboxMap(
                        initialCameraPosition:
                            vm.initialMapPosition(spots.value),
                        trackCameraPosition: true,
                        styleString: mapStyle.value,
                        onMapCreated: onMapCreated,
                        compassEnabled: true,
                        myLocationEnabled: true,
                        myLocationRenderMode: MyLocationRenderMode.COMPASS,
                        myLocationTrackingMode: MyLocationTrackingMode.None,
                        onMapClick: onMapClick,
                        onStyleLoadedCallback: onStyleLoaded,
                      ),
              );

@AAverin
Copy link
Contributor Author

AAverin commented Mar 24, 2022

I am setting my geojson and symbol layers in onStyleLoaded. Could it be too soon? Might be that this mapbox-location-bearing-layer is not there yet?

@felix-ht
Copy link
Collaborator

no this is fine

@felix-ht
Copy link
Collaborator

felix-ht commented Mar 24, 2022

can you try the new plugin version?

implementation "com.mapbox.mapboxsdk:mapbox-android-plugin-localization-v9:0.14.0" wrong plugin

also try MyLocationRenderMode.GPS

@AAverin
Copy link
Contributor Author

AAverin commented Mar 24, 2022

commit b29092 is fine

@AAverin
Copy link
Contributor Author

AAverin commented Mar 24, 2022

commit 19b541 already gives the exception

@felix-ht
Copy link
Collaborator

felix-ht commented Mar 24, 2022

yeah in b29092 the locationComponent style does not get updated. So it gets hidden under new layers. Calling applyStyle on locationComponent causes the issue.

@felix-ht
Copy link
Collaborator

felix-ht commented Mar 24, 2022

@Chaoba any ideas? this might very well be an upstream issue

@felix-ht
Copy link
Collaborator

@AAverin
Copy link
Contributor Author

AAverin commented Mar 24, 2022

@felix-ht same exception

@AAverin
Copy link
Contributor Author

AAverin commented Mar 24, 2022

Just in case it's any different

I/flutter (22317): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter (22317): │ PlatformException(error, Could not find layer: mapbox-location-bearing-layer, null, com.mapbox.mapboxsdk.style.layers.CannotAddLayerException: Could not find layer: mapbox-location-bearing-layer
I/flutter (22317): │ 	at com.mapbox.mapboxsdk.maps.NativeMapView.nativeAddLayerAbove(Native Method)
I/flutter (22317): │ 	at com.mapbox.mapboxsdk.maps.NativeMapView.addLayerAbove(NativeMapView.java:874)
I/flutter (22317): │ 	at com.mapbox.mapboxsdk.maps.Style.addLayerAbove(Style.java:215)
I/flutter (22317): │ 	at com.mapbox.mapboxsdk.location.LocationComponentPositionManager.addLayerToMap(LocationComponentPositionManager.java:41)
I/flutter (22317): │ 	at com.mapbox.mapboxsdk.location.SymbolLocationLayerRenderer.addLayers(SymbolLocationLayerRenderer.java:90)
I/flutter (22317): │ 	at com.mapbox.mapboxsdk.location.LocationLayerController.applyStyle(LocationLayerController.java:95)
I/flutter (22317): │ 	at com.mapbox.mapboxsdk.location.LocationComponent.applyStyle(LocationComponent.java:762)
I/flutter (22317): │ 	at com.mapbox.mapboxgl.MapboxMapController.updateLocationComponentLayer(MapboxMapController.java:286)
I/flutter (22317): │ 	at com.mapbox.mapboxgl.MapboxMapController.onMethodCall(MapboxMapController.java:828)
I/flutter (22317): │ 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
I/flutter (22317): │ 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:296)
I/flutter (22317): │ 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:320)
I/flutter (22317): │ 	at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$TsixYUB5E6FpKhMtCSQVHKE89gQ.run(Unknown Source:12)
I/flutter (22317): │ 	at android.os.Handler.handleCallback(Handler.java:873)
I/flutter (22317): │ 	at android.os.Handler.dispatchMessage(Handler.java:99)
I/flutter (22317): │ 	at android.os.Looper.loop(Looper.java:193)
I/flutter (22317): │ 	at android.app.ActivityThread.main(ActivityThread.java:6718)
I/flutter (22317): │ 	at java.lang.reflect.Method.invoke(Native Method)
I/flutter (22317): │ 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491)
I/flutter (22317): │ 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
I/flutter (22317): │ )
I/flutter (22317): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄

@felix-ht
Copy link
Collaborator

@AAverin
Can you add a logger to com.mapbox.mapboxgl.MapboxMapController.updateLocationComponentLayer(MapboxMapController.java:286)

That logs the input into the applyStyle function? And post the results here. I cannot reproduce the error.

@AAverin
Copy link
Contributor Author

AAverin commented Mar 24, 2022

I/MapboxMapController(30772): updateLocationComponentLayer LocationComponentOptions{accuracyAlpha=0.15, accuracyColor=-11890462, backgroundDrawableStale=2131165340, backgroundStaleName=null, foregroundDrawableStale=2131165338, foregroundStaleName=null, gpsDrawable=2131165339, gpsName=null, foregroundDrawable=2131165336, foregroundName=null, backgroundDrawable=2131165340, backgroundName=null, bearingDrawable=2131165335, bearingName=null, bearingTintColor=null, foregroundTintColor=null, backgroundTintColor=null, foregroundStaleTintColor=null, backgroundStaleTintColor=null, elevation=42.0, enableStaleState=true, staleStateTimeout=30000, padding=[0, 0, 0, 0], maxZoomIconScale=1.0, minZoomIconScale=0.6, trackingGesturesManagement=true, trackingInitialMoveThreshold=87.5, trackingMultiFingerMoveThreshold=1400.0, trackingMultiFingerProtectedMoveArea=null, layerAbove=UjtGdTNQaD_0layerBelow=nulltrackingAnimationDurationMultiplier=1.1pulseEnabled=falsepulseFadeEnabled=truepulseColor=-11890462pulseSingleDuration=2300.0pulseMaxRadius=35.0pulseAlpha=0.4}
I/MapboxMapController(30772): updateLocationComponentLayer LocationComponentOptions{accuracyAlpha=0.15, accuracyColor=-11890462, backgroundDrawableStale=2131165340, backgroundStaleName=null, foregroundDrawableStale=2131165338, foregroundStaleName=null, gpsDrawable=2131165339, gpsName=null, foregroundDrawable=2131165336, foregroundName=null, backgroundDrawable=2131165340, backgroundName=null, bearingDrawable=2131165335, bearingName=null, bearingTintColor=null, foregroundTintColor=null, backgroundTintColor=null, foregroundStaleTintColor=null, backgroundStaleTintColor=null, elevation=42.0, enableStaleState=true, staleStateTimeout=30000, padding=[0, 0, 0, 0], maxZoomIconScale=1.0, minZoomIconScale=0.6, trackingGesturesManagement=true, trackingInitialMoveThreshold=87.5, trackingMultiFingerMoveThreshold=1400.0, trackingMultiFingerProtectedMoveArea=null, layerAbove=UjtGdTNQaD_1layerBelow=nulltrackingAnimationDurationMultiplier=1.1pulseEnabled=falsepulseFadeEnabled=truepulseColor=-11890462pulseSingleDuration=2300.0pulseMaxRadius=35.0pulseAlpha=0.4}
I/MapboxMapController(30772): updateLocationComponentLayer LocationComponentOptions{accuracyAlpha=0.15, accuracyColor=-11890462, backgroundDrawableStale=2131165340, backgroundStaleName=null, foregroundDrawableStale=2131165338, foregroundStaleName=null, gpsDrawable=2131165339, gpsName=null, foregroundDrawable=2131165336, foregroundName=null, backgroundDrawable=2131165340, backgroundName=null, bearingDrawable=2131165335, bearingName=null, bearingTintColor=null, foregroundTintColor=null, backgroundTintColor=null, foregroundStaleTintColor=null, backgroundStaleTintColor=null, elevation=42.0, enableStaleState=true, staleStateTimeout=30000, padding=[0, 0, 0, 0], maxZoomIconScale=1.0, minZoomIconScale=0.6, trackingGesturesManagement=true, trackingInitialMoveThreshold=87.5, trackingMultiFingerMoveThreshold=1400.0, trackingMultiFingerProtectedMoveArea=null, layerAbove=00cBtzDzw0_0layerBelow=nulltrackingAnimationDurationMultiplier=1.1pulseEnabled=falsepulseFadeEnabled=truepulseColor=-11890462pulseSingleDuration=2300.0pulseMaxRadius=35.0pulseAlpha=0.4}

onStyleLoaded triggered

W/Mbgl    (30772): {GLThread 1815}[ParseStyle]: Layer '00cBtzDzw0_0' has an invalid value for text-font and will not render text. Output values must be contained as literals within the expression.
I/MapboxMapController(30772): updateLocationComponentLayer LocationComponentOptions{accuracyAlpha=0.15, accuracyColor=-11890462, backgroundDrawableStale=2131165340, backgroundStaleName=null, foregroundDrawableStale=2131165338, foregroundStaleName=null, gpsDrawable=2131165339, gpsName=null, foregroundDrawable=2131165336, foregroundName=null, backgroundDrawable=2131165340, backgroundName=null, bearingDrawable=2131165335, bearingName=null, bearingTintColor=null, foregroundTintColor=null, backgroundTintColor=null, foregroundStaleTintColor=null, backgroundStaleTintColor=null, elevation=42.0, enableStaleState=true, staleStateTimeout=30000, padding=[0, 0, 0, 0], maxZoomIconScale=1.0, minZoomIconScale=0.6, trackingGesturesManagement=true, trackingInitialMoveThreshold=87.5, trackingMultiFingerMoveThreshold=1400.0, trackingMultiFingerProtectedMoveArea=null, layerAbove=BTV8AITxom_0layerBelow=nulltrackingAnimationDurationMultiplier=1.1pulseEnabled=falsepulseFadeEnabled=truepulseColor=-11890462pulseSingleDuration=2300.0pulseMaxRadius=35.0pulseAlpha=0.4}
I/MapboxMapController(30772): updateLocationComponentLayer LocationComponentOptions{accuracyAlpha=0.15, accuracyColor=-11890462, backgroundDrawableStale=2131165340, backgroundStaleName=null, foregroundDrawableStale=2131165338, foregroundStaleName=null, gpsDrawable=2131165339, gpsName=null, foregroundDrawable=2131165336, foregroundName=null, backgroundDrawable=2131165340, backgroundName=null, bearingDrawable=2131165335, bearingName=null, bearingTintColor=null, foregroundTintColor=null, backgroundTintColor=null, foregroundStaleTintColor=null, backgroundStaleTintColor=null, elevation=42.0, enableStaleState=true, staleStateTimeout=30000, padding=[0, 0, 0, 0], maxZoomIconScale=1.0, minZoomIconScale=0.6, trackingGesturesManagement=true, trackingInitialMoveThreshold=87.5, trackingMultiFingerMoveThreshold=1400.0, trackingMultiFingerProtectedMoveArea=null, layerAbove=Irvv0nP0Vi_0layerBelow=nulltrackingAnimationDurationMultiplier=1.1pulseEnabled=falsepulseFadeEnabled=truepulseColor=-11890462pulseSingleDuration=2300.0pulseMaxRadius=35.0pulseAlpha=0.4}
I/MapboxMapController(30772): updateLocationComponentLayer LocationComponentOptions{accuracyAlpha=0.15, accuracyColor=-11890462, backgroundDrawableStale=2131165340, backgroundStaleName=null, foregroundDrawableStale=2131165338, foregroundStaleName=null, gpsDrawable=2131165339, gpsName=null, foregroundDrawable=2131165336, foregroundName=null, backgroundDrawable=2131165340, backgroundName=null, bearingDrawable=2131165335, bearingName=null, bearingTintColor=null, foregroundTintColor=null, backgroundTintColor=null, foregroundStaleTintColor=null, backgroundStaleTintColor=null, elevation=42.0, enableStaleState=true, staleStateTimeout=30000, padding=[0, 0, 0, 0], maxZoomIconScale=1.0, minZoomIconScale=0.6, trackingGesturesManagement=true, trackingInitialMoveThreshold=87.5, trackingMultiFingerMoveThreshold=1400.0, trackingMultiFingerProtectedMoveArea=null, layerAbove=Irvv0nP0Vi_1layerBelow=nulltrackingAnimationDurationMultiplier=1.1pulseEnabled=falsepulseFadeEnabled=truepulseColor=-11890462pulseSingleDuration=2300.0pulseMaxRadius=35.0pulseAlpha=0.4}
W/Mbgl    (30772): {GLThread 1815}[ParseStyle]: Layer '00cBtzDzw0_0' has an invalid value for text-font and will not render text. Output values must be contained as literals within the expression.

I am setting GeoJson

I/MapboxMapController(30772): updateLocationComponentLayer LocationComponentOptions{accuracyAlpha=0.15, accuracyColor=-11890462, backgroundDrawableStale=2131165340, backgroundStaleName=null, foregroundDrawableStale=2131165338, foregroundStaleName=null, gpsDrawable=2131165339, gpsName=null, foregroundDrawable=2131165336, foregroundName=null, backgroundDrawable=2131165340, backgroundName=null, bearingDrawable=2131165335, bearingName=null, bearingTintColor=null, foregroundTintColor=null, backgroundTintColor=null, foregroundStaleTintColor=null, backgroundStaleTintColor=null, elevation=42.0, enableStaleState=true, staleStateTimeout=30000, padding=[0, 0, 0, 0], maxZoomIconScale=1.0, minZoomIconScale=0.6, trackingGesturesManagement=true, trackingInitialMoveThreshold=87.5, trackingMultiFingerMoveThreshold=1400.0, trackingMultiFingerProtectedMoveArea=null, layerAbove=spots-circleslayerBelow=nulltrackingAnimationDurationMultiplier=1.1pulseEnabled=falsepulseFadeEnabled=truepulseColor=-11890462pulseSingleDuration=2300.0pulseMaxRadius=35.0pulseAlpha=0.4}
W/Mbgl    (30772): {GLThread 1815}[ParseStyle]: Layer '00cBtzDzw0_0' has an invalid value for text-font and will not render text. Output values must be contained as literals within the expression.
I/MapboxMapController(30772): updateLocationComponentLayer LocationComponentOptions{accuracyAlpha=0.15, accuracyColor=-11890462, backgroundDrawableStale=2131165340, backgroundStaleName=null, foregroundDrawableStale=2131165338, foregroundStaleName=null, gpsDrawable=2131165339, gpsName=null, foregroundDrawable=2131165336, foregroundName=null, backgroundDrawable=2131165340, backgroundName=null, bearingDrawable=2131165335, bearingName=null, bearingTintColor=null, foregroundTintColor=null, backgroundTintColor=null, foregroundStaleTintColor=null, backgroundStaleTintColor=null, elevation=42.0, enableStaleState=true, staleStateTimeout=30000, padding=[0, 0, 0, 0], maxZoomIconScale=1.0, minZoomIconScale=0.6, trackingGesturesManagement=true, trackingInitialMoveThreshold=87.5, trackingMultiFingerMoveThreshold=1400.0, trackingMultiFingerProtectedMoveArea=null, layerAbove=spots-countlayerBelow=nulltrackingAnimationDurationMultiplier=1.1pulseEnabled=falsepulseFadeEnabled=truepulseColor=-11890462pulseSingleDuration=2300.0pulseMaxRadius=35.0pulseAlpha=0.4}
W/Mbgl    (30772): {GLThread 1815}[ParseStyle]: Layer '00cBtzDzw0_0' has an invalid value for text-font and will not render text. Output values must be contained as literals within the expression.
I/MapboxMapController(30772): updateLocationComponentLayer LocationComponentOptions{accuracyAlpha=0.15, accuracyColor=-11890462, backgroundDrawableStale=2131165340, backgroundStaleName=null, foregroundDrawableStale=2131165338, foregroundStaleName=null, gpsDrawable=2131165339, gpsName=null, foregroundDrawable=2131165336, foregroundName=null, backgroundDrawable=2131165340, backgroundName=null, bearingDrawable=2131165335, bearingName=null, bearingTintColor=null, foregroundTintColor=null, backgroundTintColor=null, foregroundStaleTintColor=null, backgroundStaleTintColor=null, elevation=42.0, enableStaleState=true, staleStateTimeout=30000, padding=[0, 0, 0, 0], maxZoomIconScale=1.0, minZoomIconScale=0.6, trackingGesturesManagement=true, trackingInitialMoveThreshold=87.5, trackingMultiFingerMoveThreshold=1400.0, trackingMultiFingerProtectedMoveArea=null, layerAbove=mapbox-location-bearing-layerlayerBelow=nulltrackingAnimationDurationMultiplier=1.1pulseEnabled=falsepulseFadeEnabled=truepulseColor=-11890462pulseSingleDuration=2300.0pulseMaxRadius=35.0pulseAlpha=0.4}

E/MethodChannel#plugins.flutter.io/mapbox_maps_1(30772): Failed to handle method call
E/MethodChannel#plugins.flutter.io/mapbox_maps_1(30772): com.mapbox.mapboxsdk.style.layers.CannotAddLayerException: Could not find layer: mapbox-location-bearing-layer
E/MethodChannel#plugins.flutter.io/mapbox_maps_1(30772): 	at com.mapbox.mapboxsdk.maps.NativeMapView.nativeAddLayerAbove(Native Method)
E/MethodChannel#plugins.flutter.io/mapbox_maps_1(30772): 	at com.mapbox.mapboxsdk.maps.NativeMapView.addLayerAbove(NativeMapView.java:874)
E/MethodChannel#plugins.flutter.io/mapbox_maps_1(30772): 	at com.mapbox.mapboxsdk.maps.Style.addLayerAbove(Style.java:215)
E/MethodChannel#plugins.flutter.io/mapbox_maps_1(30772): 	at com.mapbox.mapboxsdk.location.LocationComponentPositionManager.addLayerToMap(LocationComponentPositionManager.java:41)
E/MethodChannel#plugins.flutter.io/mapbox_maps_1(30772): 	at com.mapbox.mapboxsdk.location.SymbolLocationLayerRenderer.addLayers(SymbolLocationLayerRenderer.java:90)

@felix-ht
Copy link
Collaborator

That's the issue the location component tries to place the layer above itself - which fails with the error you get

layerAbove=mapbox-location-bearing-layer

That also exactly what i tried to fix in the branch I sent you - should have worked

@felix-ht
Copy link
Collaborator

Also am I right in the assumption that the layer you added right before the crash was added with below layer?

If that's the case it would explain why the topmost layer is the mapbox one. With this i should be able to reproduce it tomorrow.

@AAverin
Copy link
Contributor Author

AAverin commented Mar 25, 2022

no, the layer, that results in a crash, is being added with belowLayer.

addSource(selectedSpots)
addSource(spots)
addLayer(spots, circles)
addLayer(spots, count)
addSymbolLayer(spots, icons, belowLayer: circles) //gives a crash
addSymbolLayer(selectedSpots, selectedIcons)

@felix-ht
Copy link
Collaborator

yeah thats what i meant - worded it poorly - fix is ready and i will create the pr soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants