Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flutter 3.x crashes #1293

Merged
merged 4 commits into from
Apr 6, 2023
Merged

Fix flutter 3.x crashes #1293

merged 4 commits into from
Apr 6, 2023

Conversation

felix-ht
Copy link
Collaborator

@felix-ht felix-ht commented Apr 3, 2023

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

@felix-ht felix-ht temporarily deployed to ANDROID_CI_DOWNLOADS_TOKEN April 3, 2023 16:57 — with GitHub Actions Inactive
@felix-ht felix-ht temporarily deployed to ANDROID_CI_DOWNLOADS_TOKEN April 3, 2023 16:58 — with GitHub Actions Inactive
@felix-ht felix-ht temporarily deployed to ANDROID_CI_DOWNLOADS_TOKEN April 3, 2023 17:07 — with GitHub Actions Inactive
@felix-ht felix-ht temporarily deployed to ANDROID_CI_DOWNLOADS_TOKEN April 3, 2023 17:07 — with GitHub Actions Inactive
@felix-ht felix-ht temporarily deployed to ANDROID_CI_DOWNLOADS_TOKEN April 3, 2023 17:15 — with GitHub Actions Inactive
@felix-ht felix-ht temporarily deployed to ANDROID_CI_DOWNLOADS_TOKEN April 3, 2023 17:15 — with GitHub Actions Inactive
@felix-ht felix-ht requested a review from andrea689 April 3, 2023 17:16
@felix-ht
Copy link
Collaborator Author

felix-ht commented Apr 3, 2023

@srmanc please take a look as well

@srmncnk
Copy link
Contributor

srmncnk commented Apr 4, 2023

That's great! I'll test it out ASAP.

@felix-ht
Copy link
Collaborator Author

felix-ht commented Apr 4, 2023

We did a partial roll out with this fix and have yet to see a crash (19 users active users today)

@srmncnk
Copy link
Contributor

srmncnk commented Apr 5, 2023

@felix-ht To me it looks good, our tests have also shown no crashes. Great work!

@felix-ht felix-ht requested a review from AAverin April 5, 2023 21:40
@felix-ht
Copy link
Collaborator Author

felix-ht commented Apr 5, 2023

Bigger roll out - two days no more crashes seems like its gone :)

@srmncnk
Copy link
Contributor

srmncnk commented Apr 6, 2023

👏 Now let's focus on some other PRs as well. ;)

@felix-ht felix-ht merged commit 9eef30d into master Apr 6, 2023
@felix-ht felix-ht deleted the fix-flutter-3.x-crashes branch April 6, 2023 17:31
@samderlust
Copy link
Contributor

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

FreeGrow added a commit to FreeGrow/maps that referenced this pull request Sep 21, 2023
@adityamputra27
Copy link

adityamputra27 commented Oct 3, 2023

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.

TheHumr pushed a commit to MobileSoftHK/maps that referenced this pull request Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants