You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
This used to work fine for v3.5.6, but we've seen this after upgrading to v4.0.0.
To Reproduce
Have a ViewModel that takes SavedStateHandle as param.
Use viewModelOf (the one from the new package) on your module.
Turn 'Don't keep activities' from the Developer Options on your phone settings.
Open the screen in which the aforementioned ViewModel is used.
Note that this does not always happen
Expected behavior
The ViewModel is instantiated correctly
Actual behavior
The app crashes with the following exception:
org.koin.core.error.InstanceCreationException: Could not create instance for '[Factory: '<redacted>.ui.screens.test.upload.UploadViewModel']'
at org.koin.core.instance.InstanceFactory.create(InstanceFactory.kt:58)
at org.koin.core.instance.FactoryInstanceFactory.get(FactoryInstanceFactory.kt:38)
at org.koin.core.registry.InstanceRegistry.resolveInstance$koin_core(InstanceRegistry.kt:110)
at org.koin.core.scope.Scope.resolveFromRegistry(Scope.kt:321)
at org.koin.core.scope.Scope.resolveFromContext(Scope.kt:311)
at org.koin.core.scope.Scope.stackParametersCall(Scope.kt:281)
at org.koin.core.scope.Scope.resolveInstance(Scope.kt:259)
at org.koin.core.scope.Scope.resolveWithOptionalLogging(Scope.kt:232)
at org.koin.core.scope.Scope.get(Scope.kt:215)
at org.koin.viewmodel.factory.KoinViewModelFactory.create(KoinViewModelFactory.kt:39)
at androidx.lifecycle.viewmodel.ViewModelProviderImpl_androidKt.createViewModel(ViewModelProviderImpl.android.kt:34)
at androidx.lifecycle.viewmodel.ViewModelProviderImpl.getViewModel$lifecycle_viewmodel_release(ViewModelProviderImpl.kt:65)
at androidx.lifecycle.viewmodel.ViewModelProviderImpl.getViewModel$lifecycle_viewmodel_release$default(ViewModelProviderImpl.kt:47)
at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.android.kt:91)
at org.koin.viewmodel.GetViewModelKt.resolveViewModel(GetViewModel.kt:60)
at <redacted>.ui.screens.test.upload.UploadScreenKt.UploadScreen(UploadScreen.kt:120)
at <redacted>.ui.navigation.ComposableSingletons$NavGraphKt$lambda-20$1.invoke(NavGraph.kt:157)
at <redacted>.ui.navigation.ComposableSingletons$NavGraphKt$lambda-20$1.invoke(NavGraph.kt:154)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:139)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.navigation.compose.NavHostKt$NavHost$32$1.invoke(NavHost.kt:694)
at androidx.navigation.compose.NavHostKt$NavHost$32$1.invoke(NavHost.kt:693)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:401)
at androidx.compose.runtime.saveable.SaveableStateHolderImpl.SaveableStateProvider(SaveableStateHolder.kt:85)
at androidx.navigation.compose.NavBackStackEntryProviderKt.SaveableStateProvider(NavBackStackEntryProvider.kt:65)
at androidx.navigation.compose.NavBackStackEntryProviderKt.access$SaveableStateProvider(NavBackStackEntryProvider.kt:1)
at androidx.navigation.compose.NavBackStackEntryProviderKt$LocalOwnersProvider$1.invoke(NavBackStackEntryProvider.kt:52)
at androidx.navigation.compose.NavBackStackEntryProviderKt$LocalOwnersProvider$1.invoke(NavBackStackEntryProvider.kt:51)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:380)
at androidx.navigation.compose.NavBackStackEntryProviderKt.LocalOwnersProvider(NavBackStackEntryProvider.kt:47)
at androidx.navigation.compose.NavHostKt$NavHost$32.invoke(NavHost.kt:693)
at androidx.navigation.compose.NavHostKt$NavHost$32.invoke(NavHost.kt:674)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:139)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.animation.AnimatedContentKt$AnimatedContent$6$1$5.invoke(AnimatedContent.kt:803)
at androidx.compose.animation.AnimatedContentKt$AnimatedContent$6$1$5.invoke(AnimatedContent.kt:792)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:118)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.animation.AnimatedVisibilityKt.AnimatedEnterExitImpl(AnimatedVisibility.kt:771)
at androidx.compose.animation.AnimatedContentKt$AnimatedContent$6$1.invoke(AnimatedContent.kt:774)
at androidx.compose.animation.AnimatedContentKt$AnimatedContent$6$1.invoke(AnimatedContent.kt:757)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.animation.AnimatedContentKt.AnimatedContent(AnimatedContent.kt:816)
at androidx.navigation.compose.NavHostKt.NavHost(NavHost.kt:646)
at androidx.navigation.compose.NavHostKt$NavHost$34.invoke(Unknown Source:29)
at androidx.navigation.compose.NavHostKt$NavHost$34.invoke(Unknown Source:10)
at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:192)
at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2825)
at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:3116)
at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3607)
at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:3552)
at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:948)
at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:1206)
at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:132)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:616)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:585)
at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:41)
at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109)
at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41)
at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1299)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1309)
at android.view.Choreographer.doCallbacks(Choreographer.java:923)
at android.view.Choreographer.doFrame(Choreographer.java:847)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1283)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8757)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.runtime.PausableMonotonicFrameClock@2593ecf, androidx.compose.ui.platform.MotionDurationScaleImpl@43d005c, StandaloneCoroutine{Cancelling}@73d5f65, AndroidUiDispatcher@550943a]
Caused by: org.koin.core.error.NoDefinitionFoundException: No definition found for type 'androidx.lifecycle.SavedStateHandle'. Check your Modules configuration and add missing type and/or qualifier!
at org.koin.core.scope.Scope.resolveFromContext(Scope.kt:532)
at org.koin.core.scope.Scope.stackParametersCall(Scope.kt:273)
at org.koin.core.scope.Scope.resolveInstance(Scope.kt:259)
at org.koin.core.scope.Scope.resolveWithOptionalLogging(Scope.kt:232)
at org.koin.core.scope.Scope.get(Scope.kt:215)
at <redacted>.ui.UiModuleKt$uiModule$lambda$33$$inlined$viewModelOf$default$27.invoke(ViewModelOf.kt:226)
at <redacted>.ui.UiModuleKt$uiModule$lambda$33$$inlined$viewModelOf$default$27.invoke(ViewModelOf.kt:99)
at org.koin.core.instance.InstanceFactory.create(InstanceFactory.kt:51)
Koin module and version:
io.insert-koin:koin-androidx-compose:4.0.0
Snippet or Sample project to help reproduce
Add a snippet or even a small sample project to hel reproduce your case.
The text was updated successfully, but these errors were encountered:
Seeing something similar in crashlytics (S22 Ultra, Android 14) though unable to reproduce locally (even after trying Don't Keep Activities). Instead, I'm using koinViewModel() with ActivityviewModelStoreOwner.
Describe the bug
This used to work fine for v3.5.6, but we've seen this after upgrading to v4.0.0.
To Reproduce
SavedStateHandle
as param.viewModelOf
(the one from the new package) on your module.Note that this does not always happen
Expected behavior
The ViewModel is instantiated correctly
Actual behavior
The app crashes with the following exception:
Koin module and version:
io.insert-koin:koin-androidx-compose:4.0.0
Snippet or Sample project to help reproduce
Add a snippet or even a small sample project to hel reproduce your case.
The text was updated successfully, but these errors were encountered: