My app is a single activity app with different screens represented by composables. I am using navigation component to handle screen navigation.
My navigation component has AnimatedNavHost as:
AnimatedNavHost(
navController = navController,
startDestination = Constants.SPLASH,
enterTransition = { initial, _ ->
slideInHorizontally(initialOffsetX = { 1000 })
},
exitTransition = { _, target ->
slideOutHorizontally(targetOffsetX = { -1000 })
},
popEnterTransition = { initial, _ ->
slideInHorizontally(initialOffsetX = { -1000 })
},
popExitTransition = { _, target ->
slideOutHorizontally(targetOffsetX = { 1000 })
}
) {
composable(Constants.SPLASH) {
Splash(navController = navController)
}
composable(Constants.HIW) {
LogoPage(
false,
true,
navController = navController
) { HowItWorks(navController = navController, false) }
.
.
.
//Other 26 'composable' elements
}
When I add even 1 more 'composable' element, my app crashes, and the logcat says:
java.lang.ArrayIndexOutOfBoundsException: length=29; index=29
at androidx.collection.SparseArrayCompat.valueAt(SparseArrayCompat.java:379)
at androidx.navigation.NavController.setGraph(NavController.kt:948)
at androidx.navigation.NavController.setGraph(NavController.kt:95)
at com.google.accompanist.navigation.animation.AnimatedNavHostKt.AnimatedNavHost(AnimatedNavHost.kt:146)
at com.google.accompanist.navigation.animation.AnimatedNavHostKt.AnimatedNavHost(AnimatedNavHost.kt:85)
How do I solve this?
Been trying a lot of things, but not able to solve. Also, there doesn't seem to be any online information regarding this.
Please help!
It is reported in this issue.
It should be fixed with Navigation
2.4.0-alpha08