mapbox / mapbox/mapbox-maps-android

Add layer failed: bad_variant_access

Open
#2,342 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :beetle:
Dominant language
Kotlin
Stars
578
Forks
161
PR merge metrics
No merged PRs in 30d

Description

## Environment

- Android OS version: Android 12
- Devices affected: Galaxy A12
- Maps SDK Version: 11.0.0

## Observed behavior and steps to reproduce

Not able to reproduce this crash however happening in live for few users

`Fatal Exception: com.mapbox.maps.MapboxStyleException: Add layer failed: bad_variant_access
at com.mapbox.maps.extension.style.layers.Layer.bindTo(Layer.java:154)
at com.mapbox.maps.extension.style.layers.LayerUtils.addLayerBelow(:16)
at com.launcher.android.radarhome.presentation.ui.radar.ui.RadarFragment$initObservers$5.invoke$lambda$6$lambda$5(RadarFragment.java:219)
at com.mapbox.maps.StyleObserver.run(:36)
at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
at android.os.MessageQueue.next(MessageQueue.java:335)
at android.os.Looper.loopOnce(Looper.java:186)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8663)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)`

## Expected behavior

It should not crash

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the Layer.bindTo and LayerUtils.addLayerBelow entry points named in the crash, then inspect the reported RadarFragment call site and the Mapbox Maps SDK 11.0.0 context. Determine a reproducible or diagnosable path for the bad_variant_access failure; done means the reported add-layer flow no longer crashes and the relevant behavior is covered by available tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.