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.
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.
zo...@gmail.com <zo...@gmail.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
ap...@google.com <ap...@google.com> #5
Branch: androidx-main
commit cb7bd694963278c03e987603f51953f0b89d3f1c
Author: Jeremy Woods <jbwoods@google.com>
Date: Fri May 21 14:03:22 2021
Fix ConcurrentModificationException on the OnDestinationChangedListener
Go back to using the CopyOnWriteArrayList to ensure that
modifying the list of OnDestinationChangedListeners is safe.
RelNote: "You will no longer get a ConcurrentModificationException when
using OnDestinationChangedListeners."
Test: NavControllerTest
Bug: 188860458
Change-Id: Ib17074c773ed9462c6a69ad384c23e28fa8abaf6
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
jb...@google.com <jb...@google.com> #6
This has been fixed internally and will be available in the Navigation 2.4.0-alpha02
release.
Description
Component used: Navigation Version used: androidx.navigation:navigation-*:2.4.0-alpha01 Devices/Android versions reproduced on:
I don't have a repro project, but I do have a stacktrace: