I have 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:
val navController = rememberAnimatedNavController()
AnimatedNavHost(
navController = navController,
startDestination = Constants.SPLASH
) {
composable(Constants.SPLASH) {
Splash(navController = navController)
}
I get the following error on running the app:
java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Set
at com.google.accompanist.navigation.animation.AnimatedNavHostKt.AnimatedNavHost$lambda-3(AnimatedNavHost.kt:323)
at com.google.accompanist.navigation.animation.AnimatedNavHostKt.AnimatedNavHost(AnimatedNavHost.kt:158)
at com.google.accompanist.navigation.animation.AnimatedNavHostKt.AnimatedNavHost(AnimatedNavHost.kt:85)
But the code works fine on using 'NavHost' instead of 'AnimatedNavHost'.
My Accompanist navigation dependency is:
implementation "com.google.accompanist:accompanist-navigation-animation:0.16.1"
My Kotlin compiler extension version is:
kotlinCompilerExtensionVersion '1.0.2'
My Kotlin version is:
'1.5.21'
I have been looking for the solution since hours, not able to find it. Please help me solve this. Thanks a lot!