Status Update
Comments
il...@google.com <il...@google.com>
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.
jb...@google.com <jb...@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.
jb...@google.com <jb...@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
na...@google.com <na...@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.
na...@google.com <na...@google.com> #7
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-compose:2.8.4
androidx.navigation:navigation-runtime:2.8.4
Description
Component used: Navigation
Version used: 2.8.1
Steps:
Second
First
there will be an exception:I move the
innerNavController
insidecomposable("first")
it fixes the problem.The problem easy can be reproduced in androidx-main navigation tests:
androidx.navigation.compose.NavHostTest#nestedNavHostRestore
composeTestRule.waitForIdle()
to the end of the test