-
-
Notifications
You must be signed in to change notification settings - Fork 710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compose Multiplatform using koinNavViewModel() to create a ViewModel will cause a crash on Android #1926
Comments
@arnaudgiuliani I looked into this and saw that the class should have this field. I have to figure that this would be fixed by stabilization in the navigation library. |
Able to reproduce on my side as well |
It's mainly due to the fact that the Navigation component library was significantly refactored in recent version and the
But,
Actually, |
I am looking at the documentation and the NavBackstackEntry still implements ViewModelStoreOwner and has the getArguments() function according to what I found here. https://developer.android.com/reference/androidx/navigation/NavBackStackEntry When I debugged the code the is NavBackstackEntry is true, is there a better place to pull documentation? |
yes known issue on current jetbrains API |
waiting for JB feedback |
Solution found in this slack thread: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1725012875898249 |
Describe the bug
In the compose multiplatform project, using koinNavViewModel() to create a ViewModel will cause a crash on Android, it is normal on iOS and desktop.
To Reproduce
Launch android app
Expected behavior
Create NavBackStackEntry ViewModel success on Android.
Koin module and version:
koin-compose-viewmodel:4.0.0-RC1
Snippet or Sample project to help reproduce
https://github.com/Reach2027/Kmp/blob/master/feature/bingwallpaper/src/commonMain/kotlin/com/reach/kmp/feature/bingwallpaper/BingWallpaperScreen.kt
line:62
The text was updated successfully, but these errors were encountered: