Closed felix-ht closed 1 year ago
@srmanc please take a look as well
That's great! I'll test it out ASAP.
We did a partial roll out with this fix and have yet to see a crash (19 users active users today)
@felix-ht To me it looks good, our tests have also shown no crashes. Great work!
Bigger roll out - two days no more crashes seems like its gone :)
👏 Now let's focus on some other PRs as well. ;)
altho this runs fine on real android device. but it throw lots of error on my android simulator
PlatformException(STYLE IS NULL, The style is null. Has onStyleLoaded() already been invoked?, null, null)
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.mapbox.mapboxsdk.maps.Style.addImage(java.lang.String, android.graphics.Bitmap, boolean)' on a null object reference
E/MethodChannel#plugins.flutter.io/mapbox_maps_1( 5106): Failed to handle method call E/MethodChannel#plugins.flutter.io/mapbox_maps_1( 5106): java.lang.NullPointerException: Attempt to invoke virtual method 'void com.mapbox.mapboxsdk.maps.Style.addImage(java.lang.String, android.graphics.Bitmap, boolean)' on a null object reference
hello i have same problem, im still can't understand what is the solution, my current flutter version is 3.16.0-2.0.pre.20 and mapbox_gl: ^0.16.0 so, my app is still crashed when i put myLocationEnabled to true.
This finally seems to fix the crashes we were getting with version 3.x of flutter - i only tested with version 3.7.8 - but it might be fine on lower versions as well. I could also remove the delayed disposal hack.
I found this by checking the how the new offical mapbox flutter lib was doing the map onDestroy. Turns out they call the onStop before the onDestory
https://github.com/mapbox/mapbox-maps-flutter/blob/47e0ec050aac30f7052e1090a61c5a8d5295d01e/android/src/main/kotlin/com/mapbox/maps/mapbox_maps/MapboxMapController.kt#L78-L79