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
I am using scope in my compose project to tie the viewmodel to the Activity, but when it is used in a Activity which is a Launcher it is crashing immediately but is not crashing when accessed later
Sample Code
class MainActivity : ComponentActivity(), AndroidScopeComponent {
override val scope: Scope by activityScope()
private lateinit var viewModel: MainViewModel
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
viewModel = scope.inject<MainViewModel>().value
installSplashScreen().setKeepOnScreenCondition {
viewModel.splashState
}
enableEdgeToEdge()
setContent {}
}
Describe the bug
I am using scope in my compose project to tie the viewmodel to the Activity, but when it is used in a Activity which is a Launcher it is crashing immediately but is not crashing when accessed later
Sample Code
class MainActivity : ComponentActivity(), AndroidScopeComponent {
}
val viewModelModule = module {
scope {
viewModel {
MainViewModel(get(), get(), get(), get())
}
}
}
class MainViewModel(
private val savedStateHandle: SavedStateHandle,
private val apiRepository: ApiRepository,
private val broadcast: BroadcastHelper,
netWorkHelper: NetWorkHelper,
) : ViewModel() {
}
To Reproduce
Koin Dependency Injection.zip
Expected behavior
App should not crash and the inject is called in onCreate by still it is throwing exception
Koin module and version:
koin-core:3.5.6
koin-android:3.5.6
koin-androidx-compose:3.5.6
The text was updated successfully, but these errors were encountered: