Closed chris-wickens closed 3 months ago
Hey Chris 👋
Do you have any updates on your side regarding this issue ?
I got the same issue on my side with Samsung S23 and A53, A54 only (Android 14 also) Using those steps to reproduce:
Result: blank map, I do not have the map displayed anymore and to be able to get it back the only way I found so far is to kill and restart the app. I don't have any logs neither when I resume the app from background
Pretty hard to investigate then and the most disturbing thing is that I have this issue only on the 3 devices mentioned earlier!
Do we have a method or something to "force" refresh / rebuild the map somehow ?
Thanks for confirming this is happening on other Android devices. I would guess that disposing and recreating the map widget (e.g. by setting a unique key then changing the key on app resume) would resolve the blank screen, at the cost of losing state e.g. position and zoom. That's not a trivial workaround for me as I have a lot of platform calls going on which invoke the route observer, but it might work for you.
Thanks for the workaround might be worth checking indeed! I will give it a try However just like you, this is definitely not trivial to implement just to ""patch"" this behaviour for only specific devices and let all the others being impacted by this patch 😞
This issue seems to be only impacting Flutter version of Mapbox since I don't have it with native code. I tried on the sample app in the example folder, same issue / I was able to reproduce. (Flutter version) So, I guess it's on Mapbox team hands to fix this issue or if we manage to find a fix and then create a pull request
I have the same problem when I switch from an application with a certain flavor to another on samsung A52s on android 14 but works fine on my other pixel phone on android 14 too, it's disturbing.
Just retested on the main branch in case this was resolved by the fix for this similar issue, but unfortunately the map is still going black after two minutes in the background. Tested in release mode on Flutter 3.16.8.
Thanks @chris-wickens. Could you share the device logs captured while this is happening?
@baleboy These are all the logs between the app being backgrounded and re-opened on a black map.
I/flutter (13229): RenderFrameFinishedEventData: time: EventTimeInterval begin: 2024-01-26 09:27:56.429, end: 2024-01-26 09:27:56.438
I/flutter (13229): MapIdleEventData: timestamp: 1706261276438000
D/VRI[MainActivity](13229): visibilityChanged oldVisibility=true newVisibility=false
I/Mapbox (13229): [maps-android\Mbgl-RenderThread]: Renderer paused
4
I/Mapbox (13229): [events_service]: Queue is empty, nothing to flush
D/VRI[MainActivity](13229): applyTransactionOnDraw applyImmediately
D/VRI[MainActivity](13229): Not drawing due to not visible
I/Mapbox (13229): [events_service]: Queue is empty, nothing to flush
I/Mapbox (13229): [maps-android\Mbgl-RenderThread]: Renderer resumed, renderThreadPrepared=true, surface.isValid=true
D/VRI[MainActivity](13229): applyTransactionOnDraw applyImmediately
I/flutter (13229): RenderFrameStartedEventData: timestamp: 1706261412863000
I/flutter (13229): RenderFrameFinishedEventData: time: EventTimeInterval begin: 2024-01-26 09:30:12.863, end: 2024-01-26 09:30:12.864
I/flutter (13229): MapIdleEventData: timestamp: 1706261412864000
D/VRI[MainActivity](13229): applyTransactionOnDraw applyImmediately
D/VRI[MainActivity](13229): Start draw after previous draw not visible
@chris-wickens, @devmobile-vulog, @florianToribio We've made some tweaks to the rendering logic, could you try out snapshot residing in https://github.com/mapbox/mapbox-maps-flutter/tree/rl/snapshot_renderer_cleanup(commit hash 22b27d160a07e1fb34d6c6e54236c13a7d0bb595) to see if the issue still reproduces?
@evil159 Thanks, I tested that snapshot and the issue is still present in both debug and release mode unfortunately.
@evil159 Thanks for the investigation. We've tested too, and unfortunately we are still reproducing the issue.
Same issue for me on Samsung A53 5G after Android 14 upgrade.
I tried some unorthodox methods to "recover" the map but nothing worked so far.
What I tried:
@bonnyfone thanks for reporting this. Did the app work fine before the Android 14 upgrade, and did anything else change other than the OS version?
@bonnyfone thanks for reporting this. Did the app work fine before the Android 14 upgrade, and did anything else change other than the OS version?
On Android 13 the map had similar problems (black screen on resume) but I was able to work around it by triggering a redrawing of the map (by changing the position of the mapbox logo) when resuming the app from the background.
At least some of these issues can be explained by this bug in Flutter specific to Samsung devices https://github.com/flutter/flutter/issues/139630. Still struggling with reproducing it on Pixel phones - we've went through ~10 pixel 6(a/pro)/7(pro) phones with Android 14 to no avail reproducing this issue.
The interesting thing is that the FlutterSurfaceView itself works fine and does not have this issue.
Any other ideas for potential workarounds?
@evil159 My Pixel 6 is enrolled in the beta programme. I'm not sure whether the issue is present in stable releases, it's my personal device so I'm reluctant to downgrade as I'd have to wipe it. I tried the Samsung requestLayout workaround but that didn't help. Rotating the device turned the map white.
@chris-wickens That seems to be the culprit, we've managed to reproduce black screen issue on Pixel 7 with the latest Android beta QPR
Thanks @evil159, that makes it less of a concern for me then assuming the issue doesn't make it into a stable release. If this is an issue with platform views in general maybe it's on the Flutter/Android teams to fix.
@chris-wickens We've addressed this in this PR https://github.com/mapbox/mapbox-maps-flutter/pull/391, we switched the default hosting mode to hybrid composition, as well as added a config option to specify your preferred mode.
Thank you all for your help investigating this! The fix is available in 1.0.0-beta.3, closing this issue, feel free to reopen if there is more to it.
But can't update the version because of this : https://github.com/mapbox/mapbox-maps-android/issues/1109
After update mapbox_maps_flutter: ^1.0.0
My app crash at launch on my Pixel 7...
But can't update the version because of this : mapbox/mapbox-maps-android#1109
After update mapbox_maps_flutter: ^1.0.0
My app crash at launch on my Pixel 7...
Please provide full logs + exception you observe (ideally in the new ticket), thanks! Also is this reproducible only on one device (Pixel 7)?
But can't update the version because of this : mapbox/mapbox-maps-android#1109 After update mapbox_maps_flutter: ^1.0.0 My app crash at launch on my Pixel 7...
Please provide full logs + exception you observe (ideally in the new ticket), thanks! Also is this reproducible only on one device (Pixel 7)?
java.lang.RuntimeException: Unable to get provider androidx.startup.InitializationProvider: androidx.startup.StartupException: androidx.startup.StartupException: androidx.startup.StartupException: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/package-name-VCfnYXvvcgeoxfVicOChTA==/base.apk"],nativeLibraryDirectories=[/data/app/package-name-VCfnYXvvcgeoxfVicOChTA==/lib/x86, /system/lib, /vendor/lib]]] couldn't find "libmapbox-common.so"
at android.app.ActivityThread.installProvider(ActivityThread.java:6242)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/package-name-VCfnYXvvcgeoxfVicOChTA==/base.apk"],nativeLibraryDirectories=[/data/app/package-name-VCfnYXvvcgeoxfVicOChTA==/lib/x86, /system/lib, /vendor/lib]]] couldn't find "libmapbox-common.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:1011)
at java.lang.System.loadLibrary(System.java:1657)
at com.mapbox.common.loader.MapboxLibraryLoader.load(MapboxLibraryLoader.kt:6)
at com.mapbox.common.CoreInitializer.create(CoreInitializer.kt:2)
at com.mapbox.common.CoreInitializer.create(CoreInitializer.kt:1)
at wj.b(AppInitializer.java:88)
... 17 more
Crash on my pixel 7 and some emulators, it works on my Samung S10
@MapleNoise as I mentioned before, full logs will be appreciated. Or, if you have deterministic crash, maybe you provide the full code sample reproducing it.
❌ Google Pixel 7. Android 14 (Crash at launch) ✅ Samsung S10. Android 10
problem package :
mapbox_maps_flutter: ^1.1.0
Launch works with : mapbox_maps_flutter: 5.1.0
but I have a freezed map when background.
My code sample : (Same crash when I remove runApp()
)
void main() async {
WidgetsFlutterBinding.ensureInitialized();
MapboxOptions.setAccessToken(MAPBOX_TOKEN);
runApp(
MaterialApp(
home: MyApp()
);
}
Full log here :
java.lang.ExceptionInInitializerError
E/AndroidRuntime(13640): at com.mapbox.maps.mapbox_maps.MapboxOptionsController.<init>(MapboxOptionsController.kt:12)
E/AndroidRuntime(13640): at com.mapbox.maps.mapbox_maps.MapboxMapsPlugin.<init>(MapboxMapsPlugin.kt:12)
E/AndroidRuntime(13640): at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:259)
E/AndroidRuntime(13640): at com.lmsporttourism.runnincity.MainActivity.configureFlutterEngine(MainActivity.kt:30)
E/AndroidRuntime(13640): at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onAttach(FlutterActivityAndFragmentDelegate.java:213)
E/AndroidRuntime(13640): at io.flutter.embedding.android.FlutterActivity.onCreate(FlutterActivity.java:634)
E/AndroidRuntime(13640): at com.lmsporttourism.runnincity.MainActivity.onCreate(MainActivity.kt:22)
E/AndroidRuntime(13640): at android.app.Activity.performCreate(Activity.java:8767)
E/AndroidRuntime(13640): at android.app.Activity.performCreate(Activity.java:8745)
E/AndroidRuntime(13640): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1519)
E/AndroidRuntime(13640): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3928)
E/AndroidRuntime(13640): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4126)
E/AndroidRuntime(13640): at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:108)
E/AndroidRuntime(13640): at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:195)
E/AndroidRuntime(13640): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:157)
E/AndroidRuntime(13640): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:90)
E/AndroidRuntime(13640): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2544)
E/AndroidRuntime(13640): at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime(13640): at android.os.Looper.loopOnce(Looper.java:232)
E/AndroidRuntime(13640): at android.os.Looper.loop(Looper.java:317)
E/AndroidRuntime(13640): at android.app.ActivityThread.main(ActivityThread.java:8501)
E/AndroidRuntime(13640): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(13640): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
E/AndroidRuntime(13640): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
E/AndroidRuntime(13640): Caused by: com.mapbox.common.MapboxInitializerException: Failed to initialize: Attempt=3, exception=[StartupException], initializer called 871 ms ago, exception.message=[androidx.startup.StartupException: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__emutls_get_address" referenced by "/data/app/~~v8D240zbzDEdI3H8hgsJbQ==/com.lmsporttourism.runnincity-qs_mCc7q9568737wB6SxEg==/base.apk!/lib/arm64-v8a/libmapbox-common.so"...], exception.cause=[StartupException], exception.cause.message=[java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__emutls_get_address" referenced by "/data/app/~~v8D240zbzDEdI3H8hgsJbQ==/com.lmsporttourism.runnincity-qs_mCc7q9568737wB6SxEg==/base.apk!/lib/arm64-v8a/libmapbox-common.so"...], extractedNativeLibs=[], isInstantApp=[false], isMainThread=[true]
E/AndroidRuntime(13640): at com.mapbox.common.BaseMapboxInitializer$Companion.init(BaseMapboxInitializer.kt:383)
E/AndroidRuntime(13640): at com.mapbox.common.BaseMapboxInitializer$Companion.init(BaseMapboxInitializer.kt:113)
E/AndroidRuntime(13640): at com.mapbox.common.BaseMapboxInitializer.init(Unknown Source:2)
E/AndroidRuntime(13640): at com.mapbox.common.SettingsServiceFactory.<clinit>(SettingsServiceFactory.java:44)
E/AndroidRuntime(13640): ... 24 more
E/AndroidRuntime(13640): Caused by: androidx.startup.StartupException: androidx.startup.StartupException: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__emutls_get_address" referenced by "/data/app/~~v8D240zbzDEdI3H8hgsJbQ==/com.lmsporttourism.runnincity-qs_mCc7q9568737wB6SxEg==/base.apk!/lib/arm64-v8a/libmapbox-common.so"...
E/AndroidRuntime(13640): at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:187)
E/AndroidRuntime(13640): at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:138)
E/AndroidRuntime(13640): at androidx.startup.AppInitializer.initializeComponent(AppInitializer.java:117)
E/AndroidRuntime(13640): at com.mapbox.common.BaseMapboxInitializer$Companion.init(BaseMapboxInitializer.kt:240)
E/AndroidRuntime(13640): ... 27 more
E/AndroidRuntime(13640): Caused by: androidx.startup.StartupException: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__emutls_get_address" referenced by "/data/app/~~v8D240zbzDEdI3H8hgsJbQ==/com.lmsporttourism.runnincity-qs_mCc7q9568737wB6SxEg==/base.apk!/lib/arm64-v8a/libmapbox-common.so"...
E/AndroidRuntime(13640): at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:187)
E/AndroidRuntime(13640): at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:173)
E/AndroidRuntime(13640): ... 30 more
E/AndroidRuntime(13640): Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__emutls_get_address" referenced by "/data/app/~~v8D240zbzDEdI3H8hgsJbQ==/com.lmsporttourism.runnincity-qs_mCc7q9568737wB6SxEg==/base.apk!/lib/arm64-v8a/libmapbox-common.so"...
E/AndroidRuntime(13640): at java.lang.Runtime.loadLibrary0(Runtime.java:1082)
E/AndroidRuntime(13640): at java.lang.Runtime.loadLibrary0(Runtime.java:1003)
E/AndroidRuntime(13640): at java.lang.System.loadLibrary(System.java:1661)
E/AndroidRuntime(13640): at com.mapbox.common.loader.MapboxLibraryLoader.load(MapboxLibraryLoader.kt:19)
E/AndroidRuntime(13640): at com.mapbox.common.CoreInitializer.create(CoreInitializer.kt:98)
E/AndroidRuntime(13640): at com.mapbox.common.CoreInitializer.create(CoreInitializer.kt:12)
E/AndroidRuntime(13640): at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:180)
E/AndroidRuntime(13640): ... 31 more
@MapleNoise Could you provide the output of your flutter doctor -v
?
@evil159 Of course :
[✓] Flutter (Channel stable, 3.16.3, on macOS 14.3 23D56 darwin-arm64, locale fr-FR)
• Flutter version 3.16.3 on channel stable at /Users/lionel.malloggi/Documents/Flutter/flutter_sdk_3.16.3
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision b0366e0a3f (5 months ago), 2023-12-05 19:46:39 -0800
• Engine revision 54a7145303
• Dart version 3.2.3
• DevTools version 2.28.4
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/lionel.malloggi/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15E204a
• CocoaPods version 1.15.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2023.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 14.3 23D56 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.62
! Error: Browsing on the local area network for iPhone de Lio. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources
• All expected network resources are available.
• No issues found!
@MapleNoise Thank you for providing the diagnostic information!
We suspect that this could be caused by having dependencies compiled with incompatible versions of NDK, would it be possible to for you to provide a sample project showcasing this crash?
@evil159 Thanks you, it was the good way to investigate. I create annexe project with only depencies calls
It's flutter_vlc_player
library which cause crash when is coupled with mapbox_map_flutter : >= 1.0.0
. It solves the problem of form but not the underlying problem.
Anyway no more freeze/black map since update.
Thanks again
After loading the example app in either debug or release mode, I background the app for two minutes, return to it and find the map has either gone blank or frozen entirely. Two minutes is enough time for it to occur consistently, but it can happen as a result of quickly switching to a different app and back. The logs don't show anything that would indicate the cause, at least to my eyes.
Android version 14 AP11.231020.016.A1
Logs
I/DisplayManager(30476): DLD(CHANGED, display=0, mEventsMask=111, mPackageName=com.mapbox.maps.flutter.example, msg.obj=DisplayInfo{"Built-in Screen", displayId 0, displayGroupId 0, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS, FLAG_TRUSTED, real 1080 x 2400, largest app 2272 x 2209, smallest app 1080 x 943, appVsyncOff 6233333, presDeadline 11500000, mode 2, renderFrameRate 90.0, defaultMode 2, userPreferredModeId -1, modes [{id=1, width=1080, height=2400, fps=60.0, alternativeRefreshRates=[90.0], supportedHdrTypes=[2, 3, 4]}, {id=2, width=1080, height=2400, fps=90.0, alternativeRefreshRates=[60.0], supportedHdrTypes=[2, 3, 4]}], hdrCapabilities HdrCapabilities{mSupportedHdrTypes=[2, 3, 4], mMaxLuminance=800.0, mMaxAverageLuminance=120.0, mMinLuminance=5.0E-4}, userDisabledHdrTypes [], minimalPostProcessingSupported false, rotation 0, state ON, committedState ON}, listener=class android.view.ViewRootImpl$3) I/DisplayManager(30476): Sending onDisplayChanged: Display Changed. Info: DisplayInfo{"Built-in Screen", displayId 0, displayGroupId 0, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS, FLAG_TRUSTED, real 1080 x 2400, largest app 2272 x 2209, smallest app 1080 x 943, appVsyncOff 6233333, presDeadline 11500000, mode 2, renderFrameRate 90.0, defaultMode 2, userPreferredModeId -1, modes [{id=1, width=1080, height=2400, fps=60.0, alternativeRefreshRates=[90.0], supportedHdrTypes=[2, 3, 4]}, {id=2, width=1080, height=2400, fps=90.0, alternativeRefreshRates=[60.0], supportedHdrTypes=[2, 3, 4]}], hdrCapabilities HdrCapabilities{mSupportedHdrTypes=[2, 3, 4], mMaxLuminance=800.0, mMaxAverageLuminance=120.0, mMinLuminance=5.0E-4}, userDisabledHdrTypes [], minimalPostProcessingSupported false, rotation 0, state ON, committedState ON} I/VRI[MainActivity](30476): Received onDisplayChanged - com.android.internal.policy.DecorView{c3d35cf V.E...... R....... 0,0-1080,2400 aid=0}[MainActivity] D/DisplayManager(30476): getDisplayInfo: displayId=0, info=DisplayInfo{"Built-in Screen", displayId 0, displayGroupId 0, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS, FLAG_TRUSTED, real 1080 x 2400, largest app 2272 x 2209, smallest app 1080 x 943, appVsyncOff 6233333, presDeadline 11500000, mode 2, renderFrameRate 90.0, defaultMode 2, userPreferredModeId -1, modes [{id=1, width=1080, height=2400, fps=60.0, alternativeRefreshRates=[90.0], supportedHdrTypes=[2, 3, 4]}, {id=2, width=1080, height=2400, fps=90.0, alternativeRefreshRates=[60.0], supportedHdrTypes=[2, 3, 4]}], hdrCapabilities HdrCapabilities{mSupportedHdrTypes=[2, 3, 4], mMaxLuminance=800.0, mMaxAverageLuminance=120.0, mMinLuminance=5.0E-4}, userDisabledHdrTypes [], minimalPostProcessingSupported false, rotation 0, state ON, committedState ON} I/VRI[MainActivity](30476): DisplayState - old: 2, new: 2 I/Mapbox (30476): [threading]: Worker 3 priority is now 4 I/Mapbox (30476): [events_service]: Queue is empty, nothing to flush