mapbox / mapbox/mapbox-plugins-android

com.mapbox.mapboxsdk.style.sources.CannotAddSourceException: Source already exists

Open
#1,170 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
242
Forks
116
PR merge metrics
No merged PRs in 30d

Description

when I use MapboxMap in My fragment
`2021-01-11 16:05:41.619 14347-14347/com.jinribeidou.hailiao.test E/Mbgl-MapChangeReceiver: Exception in onDidFinishLoadingStyle
com.mapbox.mapboxsdk.style.sources.CannotAddSourceException: Source mapbox-android-symbol-source-3 already exists
at com.mapbox.mapboxsdk.maps.NativeMapView.nativeAddSource(Native Method)
at com.mapbox.mapboxsdk.maps.NativeMapView.addSource(NativeMapView.java:937)
at com.mapbox.mapboxsdk.maps.Style.addSource(Style.java:119)
at com.mapbox.mapboxsdk.plugins.annotation.AnnotationManager.initializeSourcesAndLayers(AnnotationManager.java:351)
at com.mapbox.mapboxsdk.plugins.annotation.AnnotationManager.access$200(AnnotationManager.java:38)
at com.mapbox.mapboxsdk.plugins.annotation.AnnotationManager$1$1.onStyleLoaded(AnnotationManager.java:95)
at com.mapbox.mapboxsdk.maps.MapboxMap.getStyle(MapboxMap.java:121)
at com.mapbox.mapboxsdk.plugins.annotation.AnnotationManager$1.onDidFinishLoadingStyle(AnnotationManager.java:91)
at com.mapbox.mapboxsdk.maps.MapChangeReceiver.onDidFinishLoadingStyle(MapChangeReceiver.java:198)
at com.mapbox.mapboxsdk.maps.NativeMapView.onDidFinishLoadingStyle(NativeMapView.java:1166)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:363)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:8349)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055)`

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 in AnnotationManager.java at initializeSourcesAndLayers and its onStyleLoaded callback, then trace the Style.addSource call shown in the report. Use the reported MapboxMap style-loading scenario to investigate the duplicate source; done means the reported CannotAddSourceException no longer occurs.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.