У меня проблема с Android Dynami c Особенности навигации . Когда я вернулся в приложение после долгого бездействия (или с включенной опцией «Не сохранять активность»), мое приложение зависало. Cra sh происходит от DynamicIncludeGraphNavigator.onRestoreState()
метода и вызывается java.util.ConcurrentModificationException
. Кто-нибудь знает, как решить эту проблему?
Версия библиотеки: 2.3.0-alpha04
Полная трассировка стека:
Caused by: android.view.InflateException: Binary XML file line #19 in activity_main: Error inflating class fragment
Caused by: java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.remove(ArrayList.java:875)
at androidx.navigation.dynamicfeatures.DynamicIncludeGraphNavigator.onRestoreState(DynamicIncludeGraphNavigator.kt:122)
at androidx.navigation.NavController.onGraphCreated(NavController.java:595)
at androidx.navigation.NavController.setGraph(NavController.java:583)
at androidx.navigation.NavController.setGraph(NavController.java:548)
at androidx.navigation.NavController.setGraph(NavController.java:530)
at androidx.navigation.fragment.NavHostFragment.onCreate(NavHostFragment.java:237)
at androidx.fragment.app.Fragment.performCreate(Fragment.java:2684)
at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:280)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1175)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1356)
at androidx.fragment.app.FragmentLayoutInflaterFactory.onCreateView(FragmentLayoutInflaterFactory.java:135)
at androidx.fragment.app.FragmentController.onCreateView(FragmentController.java:135)
at androidx.fragment.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:356)
at androidx.fragment.app.FragmentActivity.onCreateView(FragmentActivity.java:335)
at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1069)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:997)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
at android.view.LayoutInflater.inflate(LayoutInflater.java:682)
at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
at android.view.LayoutInflater.inflate(LayoutInflater.java:481)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
at androidx.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:303)
at androidx.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:284)
DynamicIncludeGraphNavigator.onRestoreState()
содержимое:
override fun onRestoreState(savedState: Bundle) {
super.onRestoreState(savedState)
val iterator = createdDestinations.iterator()
while (iterator.hasNext()) {
val dynamicNavGraph = iterator.next()
val moduleName = dynamicNavGraph.moduleName
if (moduleName == null || !installManager.needsInstall(moduleName)) {
replaceWithIncludedNav(dynamicNavGraph)
}
iterator.remove()
}
}