Fixed
Status Update
Comments
jb...@google.com <jb...@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.
ap...@google.com <ap...@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.
Description
Component used: Navigation
Version used: 2.8.0-beta06
Given a data class like:
If you do
navigate(ScreenBRoute)
, you get a Lint warning, but you don't get the same kind of error when doingpopBackStack(ScreenBRoute, inclusive = false)
.Ideally, it would warn you and offer it to replace to
popBackStack<ScreenBRoute>(inclusive = false)
.