Status Update
Comments
ap...@google.com <ap...@google.com> #2
I don't think this is enough cause we don't know how it is being produced. If you could create a project that recreates this that would be great, if not please provide us with the steps and we can see if that helps.
il...@google.com <il...@google.com> #3
It looks like we were using a CopyOnWriteArrayList
in the Java version of NavController, which was resilient to removing an OnDestinationChangedListener
as part of the dispatch i.e.,
addOnDestinationChangedListener(object : OnDestinationChangedListener {
override fun onDestinationChanged(
controller: NavController,
destination: NavDestination,
arguments: Bundle?
) {
removeOnDestinationChangedListener(this)
}
})
// Note, you need to have at least one other OnDestinationChangedListener
// that is added after the one that is removed to duplicate this error
We lost that resiliency when we converted over to Kotlin, hence this error. We need to switch back.
na...@google.com <na...@google.com> #4
We get this crash as well. I have a simple sample project where it can't be reproduced so it could be due to our nested graphs.
Kinda tl;dr scenario where it happens Graph 1 > Graph 2 (Graph 2 has bottom hav) - Navigate to dynamic feature module and click back - Navigate with BottomNavigationView.
I've spent some time trying to get a sample project which recreates the crash without success as the request in #2. Is that still needed after
Description
Would be nice if we add this as a NavDestination extended function for custom implementations of onDestinationChanged.