mapbox-maps-android
mapbox-maps-android copied to clipboard
App Crash for Many Users
Crashes Only in Release APK with MinifyEnabled:true
Fatal Exception: com.mapbox.maps.MapboxStyleException: Add source failed: Source current_location_id already exists
at com.mapbox.maps.extension.style.sources.Source.bindTo(Source.java:89)
at com.mapbox.maps.MapboxMap.loadStyle$lambda-8(MapboxMap.java:31)
at com.mapbox.maps.MapboxMap.$r8$lambda$gb8NbKbZF2nHGNlOyo6Nw1Ys3gg(MapboxMap.java)
at com.mapbox.maps.MapboxMap$$InternalSyntheticLambda$1$7f54bca300e253fbf079bb77c512220c713911409a93dbfd56a5def85db3ad5e$1.onStyleLoaded(MapboxMap.java:2)
at com.mapbox.maps.StyleObserver.onStyleSourcesReady(StyleObserver.java:13)
at com.mapbox.maps.StyleObserver.onStyleDataLoaded(StyleObserver.java:27)
at com.mapbox.maps.NativeObserver.notify(NativeObserver.java:352)
at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
at android.os.MessageQueue.next(MessageQueue.java:335)
at android.os.Looper.loop(Looper.java:195)
at android.app.ActivityThread.main(ActivityThread.java:8024)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)
Here is code added in App
mapView.getMapboxMap().loadStyle(
style(styleType) {
+geoJsonSource("current_location_id") {
geometry(getCurrentLocationCircle())
}
+layerAtPosition(
fillLayer("current_location_id", "current_location_id") {
fillOpacity(0.3)
fillColor("#e51500")
},
)
}
)
@arun-ns
- can you reproduce this crash locally from your side?
- could it be the case that it happens when style is switching from one to another?
We couldn't reproduce in locally. We got more than 10k crashes in Firebase Crashlytics @kiryldz
we're using rnmapbox which uses mapbox-maps-android under the hood and are also finding very frequent crashes in production. unfortunately the repro is inconsistent and seems to be some sort of race condition. it seems related to dynamic layers:
Exception com.mapbox.maps.MapboxStyleException:
at com.mapbox.maps.extension.style.layers.Layer.updateProperty (Layer.kt:143)
at com.mapbox.maps.extension.style.layers.Layer.setProperty$extension_style_release (Layer.kt:132)
at com.mapbox.maps.extension.style.layers.generated.SymbolLayer.iconImage (SymbolLayer.kt:379)
at com.mapbox.rctmgl.components.styles.RCTMGLStyleFactory.setIconImage (RCTMGLStyleFactory.java:1322)
at com.mapbox.rctmgl.components.styles.RCTMGLStyleFactory$3.onAllImagesLoaded (RCTMGLStyleFactory.java:245)
at com.mapbox.rctmgl.utils.DownloadMapImageTask.onPostExecute (DownloadMapImageTask.kt:128)
at com.mapbox.rctmgl.utils.DownloadMapImageTask.onPostExecute (DownloadMapImageTask.kt:30)
at android.os.AsyncTask.finish (AsyncTask.java:695)
at android.os.AsyncTask.access$600 (AsyncTask.java:180)
at android.os.AsyncTask$InternalHandler.handleMessage (AsyncTask.java:712)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:214)
at android.app.ActivityThread.main (ActivityThread.java:7124)
at java.lang.reflect.Method.invoke
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:975)
@kiryldz Exactly, it happens when the style is switching. However, we use rnmapbox, so there is no way to provide a good example
@orca-nazar @wen-kai I assume you should then transfer this to rnmapbox repo... @mfazekas - does this ring a bell perhaps?
@kiryldz the iconImage issue we have in @rnmapbox repo - https://github.com/rnmapbox/maps/issues/2289 - was closed as no code to repro was posted there
Thanks for the responses @kiryldz @mfazekas. After diving deeper into what the source/layer causes the issues on our app, I found a way to reproduce in rnmabox test app. Created a ticket with included all steps https://github.com/rnmapbox/maps/issues/3152
Closing this one then.