Hello, I’m having a strange stack trace in a KMM p...
# koin
g
Hello, I’m having a strange stack trace in a KMM project (Android, iOS, Desktop):
Copy code
> Task :desktopApp:run
Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Module with the Main dispatcher is missing. Add dependency providing the Main dispatcher, e.g. 'kotlinx-coroutines-android' and ensure it has the same version as 'kotlinx-coroutines-core'
...
Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@71435f82, Dispatchers.Main[missing]]
Exception in thread "main" org.koin.core.error.InstanceCreationException: Could not create instance for [Factory:'com.expressus.domain.viewModels.ExpressusViewModel']
        at org.koin.core.instance.InstanceFactory.create(InstanceFactory.kt:61)
        at org.koin.core.instance.FactoryInstanceFactory.get(FactoryInstanceFactory.kt:38)
        at org.koin.core.registry.InstanceRegistry.resolveInstance$koin_core(InstanceRegistry.kt:111)
        at org.koin.core.scope.Scope.resolveValue(Scope.kt:237)
        at org.koin.core.scope.Scope.resolveInstance(Scope.kt:224)
        at org.koin.core.scope.Scope.get(Scope.kt:205)
But it only throws in desktop. More in 🧵
The code can be found here: https://github.com/GuilhE/Expressus branch main using Kotlin 1.6.10 works fine. Branch feature/kotlin-1.7.20-update fails. Honestly I don’t even know if this is a Koin issue, but I have no idea how to solve or whom to ask. I’ve searched the web and nothing useful popped out. Maybe you can point me in the right direction. Thanks 🙏
a
Seems on the tpo, like a Coroutines issue
Koin 3.2.x is working against Kotlin 1.6.x
perhaps something missing around? 🤔
g
I have no idea because it works when I lower Kotlin version to 1.6.10 and it throws starting 1.6.21 🤷
remaining dependencies can be the last versions
I’ll ask also in #compose-desktop, thanks for your time @arnaud.giuliani 😉
Solved, turns out it was a missing dependency in the jvm, although it kind of feels strange to add it there. It’s working 😇
a
good 🙂 👍