mapbox / mapbox/mapbox-maps-flutter
getManager() in AnnotationController.kt Crashes
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 380
- Forks
- 204
- PR merge metrics
- No merged PRs in 30d
Description
We are using the Mapbox library in our Flutter application, along with Firebase Crashlytics integration.
During app usage, we encountered a crash that appears to originate from a Mapbox library method and likely requires attention from the Mapbox team.
The crash occurs in the **getManager()** method while fetching the manager for **PointAnnotationController**. Ideally, the code should first verify whether a manager exists for the given ID before attempting to fetch it. If the manager is not found, it should return an appropriate message or handle the case gracefully instead of throwing an exception — since this crash also affects the overall stability of the application.
Problem Description
Expected Behavior (according to SDK documentation):
Annotations (markers, shapes, or other overlays) should be safely created and managed only after the Mapbox map instance is fully initialized.
Actual Behavior:
The app crashes with a RuntimeException – “No manager found” – when annotations are created before the Mapbox map is fully initialized.
The crash occurs within AnnotationController.getManager, indicating that the annotation manager is null or not yet registered.
Logs:
System logs (Logcat):
Fatal Exception: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:614)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Caused by java.lang.reflect.InvocationTargetException:
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Caused by java.lang.Throwable: No manager found with id: 2
at com.mapbox.maps.mapbox_maps.annotation.AnnotationController.getManager(AnnotationController.kt:227)
at com.mapbox.maps.mapbox_maps.annotation.PointAnnotationController.delete(PointAnnotationController.kt:137)
at com.mapbox.maps.mapbox_maps.pigeons._PointAnnotationMessenger$Companion.setUp$lambda$15$lambda$14(PointAnnotationMessenger.kt:1483)
at io.flutter.plugin.common.BasicMessageChannel$IncomingMessageHandler.onMessage(BasicMessageChannel.java:261)
at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0(DartMessenger.java:319)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8762)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Also, attached below are the screenshots of the code section where the crash occurs and the corresponding Crashlytics logs.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with AnnotationController.kt at getManager and PointAnnotationController.kt at delete, using the provided stack trace to reproduce the missing-manager path during map initialization. Done means deleting an annotation before manager registration no longer throws the reported RuntimeException and is handled gracefully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter, kotlin
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100