John O'Reilly
06/09/2025, 10:42 AMKoinApplicationPreview
in 4.1.....should something like following work? I'm getting render issue as soon as I add the `koinViewModel`but I could be missing something else perhaps
@Preview
@Composable
fun PreviewPlayerListView() {
KoinApplicationPreview(application = { modules(appModule, commonModule(false)) }) {
SomeComposable()
}
}
@Composable
fun SomeComposable() {
val playerListViewModel = koinViewModel<PlayerListViewModel>()
Text("hey there")
}
John O'Reilly
06/09/2025, 10:43 AMFailed to instantiate a ViewModel
if I change to say
@Composable
fun SomeComposable() {
val repo = koinInject<FantasyPremierLeagueRepository>()
Text("hey there")
}
then the render issue shown is
Failed to instantiate Composition Local
arnaud.giuliani
06/09/2025, 1:06 PMkoinInject
here?John O'Reilly
06/09/2025, 1:07 PMkoinViewModel
in first caseJohn O'Reilly
06/09/2025, 1:09 PMJohn O'Reilly
06/09/2025, 1:16 PMPlayersListView.kt
John O'Reilly
06/09/2025, 1:16 PMJohn O'Reilly
06/09/2025, 1:17 PMarnaud.giuliani
06/09/2025, 1:44 PMJohn O'Reilly
06/09/2025, 1:45 PMJohn O'Reilly
06/09/2025, 1:45 PMarnaud.giuliani
06/09/2025, 2:03 PMarnaud.giuliani
06/09/2025, 2:03 PMJohn O'Reilly
06/09/2025, 2:03 PMarnaud.giuliani
06/09/2025, 3:23 PMJohn O'Reilly
06/09/2025, 3:43 PMJohn O'Reilly
06/09/2025, 7:13 PMJohn O'Reilly
06/09/2025, 7:31 PMMark
06/10/2025, 5:08 AMHelp / Show Log in Finder
?John O'Reilly
06/10/2025, 7:34 AMjava.lang.IllegalStateException: KoinApplication has not been started
at org.koin.core.context.GlobalContext.get(GlobalContext.kt:36)
at org.koin.core.component.KoinComponent$DefaultImpls.getKoin(KoinComponent.kt:33)
at dev.johnoreilly.common.data.repository.FantasyPremierLeagueRepository.getKoin(FantasyPremierLeagueRepository.kt:27)
arnaud.giuliani
06/10/2025, 1:16 PMJohn O'Reilly
06/10/2025, 1:16 PMarnaud.giuliani
06/10/2025, 1:18 PMFantasyPremierLeagueRepository
?John O'Reilly
06/10/2025, 1:25 PMKoinApplicationPreview
?John O'Reilly
06/10/2025, 1:25 PMJohn O'Reilly
06/10/2025, 1:26 PMKoinApplicationPreview
and KoinComponent
are trying to init koin?arnaud.giuliani
06/10/2025, 1:58 PMarnaud.giuliani
06/10/2025, 1:59 PMarnaud.giuliani
06/10/2025, 1:59 PMarnaud.giuliani
06/10/2025, 1:59 PMarnaud.giuliani
06/10/2025, 1:59 PM