Closed Daeng96 closed 2 years ago
Are you using Jetpack Navigation too (androidx.navigation:navigation-compose)? Can you verify the version being used is 2.5.0 ?
Was having the same problem but after adding androidx.navigation:navigation-compose:2.5.0,
the crash is gone but do we really need compose-navigation
explicitly if we use hilt-navigation-compose
?
Was having the same problem but after adding
androidx.navigation:navigation-compose:2.5.0,
the crash is gone but do we really needcompose-navigation
explicitly if we usehilt-navigation-compose
?
Ok, thanks. Work
We had also experienced this error in the Home Assistant app. We already had the navigation-compose
dependency mentioned. We needed to add androidx.fragment
dependency and the crash went away. Just commenting here for the next person who may get stuck :)
I had the same issue and resolved it by adding implementation("androidx.fragment:fragment-ktx:1.5.1")
dependency. Fragment.viewModels()
is defined in this library and previously it was only transitive dependency resolved to the older version.
In my case, I was having this issue and I solved it by upgrading navigation to 2.5.1
. I'm not using navigation-compose
as previous answers say, so I'll include the list of my dependencies related to navigation in case it is helpful somebody else:
navigation_version = "2.5.1"
compose_version = "1.2.0"
kotlin_version = "1.7.0"
dagger_hilt_version = "2.43.2"
implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version"
implementation "androidx.navigation:navigation-ui-ktx:$navigation_version"
implementation "androidx.navigation:navigation-dynamic-features-fragment:$navigation_version"
// Unit tests
testImplementation "androidx.navigation:navigation-testing:$navigation_version"
// UI tests
androidTestImplementation "androidx.navigation:navigation-testing:$navigation_version"
We had also experienced this error in the Home Assistant app. We already had the
navigation-compose
dependency mentioned. We needed to addandroidx.fragment
dependency and the crash went away. Just commenting here for the next person who may get stuck :)
Yes totally required to add "androidx.fragment:fragment-ktx", even if you are not using any Fragment in your module, working in Hilt v2.44.
Indeed as @gerardoepitacio mentioned "androidx.fragment:fragment-ktx" was the fix. Thx.
latest androidx.navigation:navigation-fragment-ktx
version supplied to my modules fixed the error
Added implementation("androidx.fragment:fragment-ktx:1.5.1")
but it did not solve the crash. Am I the only one?
I do not use Fragment.viewModels()
instead I call hiltViewModel()
extension
Are you using Jetpack Navigation too (androidx.navigation:navigation-compose)? Can you verify the version being used is 2.5.0 ?
This saved my life!!! Thanks
dependencies: