maplibre-navigation-android
maplibre-navigation-android copied to clipboard
Crash while updating the Notification Views
Android: 7 - 13 Android API: 24 - 33 Maplibre Navigation SDK version: 2.0.0
Stacktrace
java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 671536 bytes
at android.app.NotificationManager.notifyAsUser(NotificationManager.java:700)
at android.app.NotificationManager.notify(NotificationManager.java:632)
at android.app.NotificationManager.notify(NotificationManager.java:608)
at com.mapbox.services.android.navigation.v5.navigation.MapboxNavigationNotification.updateNotificationViews(MapboxNavigationNotification.java:173)
at com.mapbox.services.android.navigation.v5.navigation.MapboxNavigationNotification.updateNotification(MapboxNavigationNotification.java:79)
at com.mapbox.services.android.navigation.v5.navigation.NavigationNotificationProvider.updateNavigationNotification(NavigationNotificationProvider.java:23)
at com.mapbox.services.android.navigation.v5.navigation.RouteProcessorThreadListener.onNewRouteProgress(RouteProcessorThreadListener.java:33)
at com.mapbox.services.android.navigation.v5.navigation.RouteProcessorHandlerCallback$1.run(RouteProcessorHandlerCallback.java:97)
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:8741)
at java.lang.reflect.Method.invoke(Method.java:-2)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Caused by: android.os.TransactionTooLargeException: data parcel size 671536 bytes
at android.os.BinderProxy.transactNative(BinderProxy.java:-2)
at android.os.BinderProxy.transact(BinderProxy.java:653)
at android.app.INotificationManager$Stub$Proxy.enqueueNotificationWithTag(INotificationManager.java:4011)
at android.app.NotificationManager.notifyAsUser(NotificationManager.java:697)
at android.app.NotificationManager.notify(NotificationManager.java:632)
at android.app.NotificationManager.notify(NotificationManager.java:608)
at com.mapbox.services.android.navigation.v5.navigation.MapboxNavigationNotification.updateNotificationViews(MapboxNavigationNotification.java:173)
at com.mapbox.services.android.navigation.v5.navigation.MapboxNavigationNotification.updateNotification(MapboxNavigationNotification.java:79)
at com.mapbox.services.android.navigation.v5.navigation.NavigationNotificationProvider.updateNavigationNotification(NavigationNotificationProvider.java:23)
at com.mapbox.services.android.navigation.v5.navigation.RouteProcessorThreadListener.onNewRouteProgress(RouteProcessorThreadListener.java:33)
at com.mapbox.services.android.navigation.v5.navigation.RouteProcessorHandlerCallback$1.run(RouteProcessorHandlerCallback.java:97)
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:8741)
at java.lang.reflect.Method.invoke(Method.java:-2)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
- This same crash happens with different parcel size: 671536, 232436, 2088980,1039932 bytes and many others.
- Using the default
NavigationNotification
implementation.
Steps to trigger behavior
- Start Navigation
- Navigate through the route
- Crash
Expected behavior
Updating notification without crash
Actual behavior
Crashing while updating notification
Thank's for your report!
Does this happen every time or only sometimes?
We will have a look at in the near future.
Only sometimes for now (a few dozens). Because we just release the new version widely this number will increase.
It did not occur while testing internally, only now with our customers
I see this same error on our app too. There exists a lot of Mapbox issues about this topic. The most mentioned cause is that the navigation view is growing with every update. So long time navigations are crashing with this error, while the notification is too big after (for example) 100 updates.
But I'm still working on a solution on this. But it's very hard to test and reproduce. Feel free to provide a solution to everyone.
I just reduced the complexity of the notification with a custom implementation. It helped a lot, but didn't prevent the crashes. My latest attempt is to wrap it with a try-catch for now, until we find a solution.
try {
notificationManager.notify(NavigationConstants.NAVIGATION_NOTIFICATION_ID, notificationBuilder!!.build())
} catch (e: RuntimeException) {
// to catch two different exceptions, TransactionTooLargeException and
// DeadSystemException (API 24+) re-thrown as Runtime exception
Timber.e(e)
}