InsertKoinIO / koin

Koin - a pragmatic lightweight dependency injection framework for Kotlin & Kotlin Multiplatform
https://insert-koin.io
Apache License 2.0
9.08k stars 719 forks source link

Can't create instance on Desktop when using Kotlin Multiplatform #1703

Closed DawnHNguyen closed 1 year ago

DawnHNguyen commented 1 year ago

Describe the bug I'm using KMP in my project, so I want it both have android, iOS, and desktop. The Koin work well on iOS and Android. But when I run my code on desktop, the log say that koin can't create instance of my UseCase and Repository

Expected behavior Koin should create instance of my UseCase and Repository with single and factory, so that I can inject it into my ViewModel and do the thing I need

Koin module and version: koin-core:3.4.3 (even if I upgrade it to 3.5.0, nothing change) koin-compose:1.1.0

My Log

Exception in thread "AWT-EventQueue-0" org.koin.core.error.InstanceCreationException: Could not create instance for '[Factory:'com.mypackage.usecases.MyUseCase']'
    at org.koin.core.instance.InstanceFactory.create(InstanceFactory.kt:57)
    at org.koin.core.instance.FactoryInstanceFactory.get(FactoryInstanceFactory.kt:38)
    at org.koin.core.registry.InstanceRegistry.resolveInstance$koin_core(InstanceRegistry.kt:116)
    at org.koin.core.scope.Scope.resolveValue(Scope.kt:247)
    at org.koin.core.scope.Scope.resolveInstance(Scope.kt:233)
    at org.koin.core.scope.Scope.get(Scope.kt:212)
DawnHNguyen commented 1 year ago

Sorry guys, it my fail at my SQL code.