Is there a Dependency Injection Library that works...
# multiplatform
t
Is there a Dependency Injection Library that works for iOS, Android and JVM? Most I found don't work on JVM or not well... What are you guys using?
f
I guess, it's now a reference on KMP
t
Hmm, I tried that earlier but It crashed on startup.
Exception in thread "main" java.lang.UnsatisfiedLinkError: 'long org.jetbrains.skia.paragraph.TypefaceFontProviderWithFallbackKt._nMakeAsFallbackProvider()'
j
I'm using Koin for most of the KMP samples at https://github.com/joreilly .....and most of those have JVM target (along with Android/iOS and frequently other platforms). Maybe compare setup/versions you're using with some of those.
t
I will, thanks!
h
d
I've used Kodein so far
t
I managed to get it working via Koin. For future reference for people, these are my dependencies:
Copy code
koin = "4.0.0-RC1"
koin-compose = "1.2.0-Beta5"

koin-core = { group = "io.insert-koin", name = "koin-core", version.ref = "koin" }
koin-compose = { group = "io.insert-koin", name = "koin-compose", version.ref = "koin" }
koin-compose-viewmodel = { group = "io.insert-koin", name = "koin-compose-viewmodel", version.ref = "koin-compose" }
The problem that I initially had was that for
koin-compose-viewmodel
I was using
4.0.0-RC1
too, though it seems like that has a bug currently causing the crash. This version combination does work correctly. Also don't forget to
startKoin
in your
Main.kt
of your JVM/Desktop application
👍 1