Hi everyone! I'm using the Koin Compiler Plugin in...
# kotlin-toolchain
s
Hi everyone! I'm using the Koin Compiler Plugin in a Compose Multiplatform project built with the Kotlin toolchain. In a standard Android Gradle project, I can easily initialize dependencies by calling
startKoin<App> { }
in the Android app. However, in the Kotlin toolchain setup, doing this fails to find my shared definitions at runtime. As a workaround, I'm currently forced to initialize the modules manually using
modules(AppModule().module())
.
j
Thanks for the report, I'll have a look
Hi again @Sai Charan, by any chance, could you please share the error you get? And/or the project to reproduce? Also, did you try the same KMP project setup in Gradle? Or are you comparing Android+Gradle to KMP+Kotlin Toolchain? (trying to see if it could just be a problem on Koin side)
s
Hi, When I set up the Koin Compiler Plugin and add all the annotations to my ViewModels and other classes, the app crashes with
org.koin.core.error.NoDefinitionFoundException
. However, if I manually register the generated module by calling:
Copy code
modules(AppModule().module())
inside
startKoin
, the app runs without any issues. I have the same Koin Compiler setup in another project that uses a standard Gradle setup, and there I only need to call:
Copy code
startKoin<App> { }
and everything works correctly. I'm not sure if I'm missing something in my Kotlin Toolchain project configuration.
j
Thanks! Is your Kotlin Toolchain project open source? I'd like to try to reproduce this locally.
I also found this issue that might be related: https://github.com/InsertKoinIO/koin/issues/2380
s
This is the project
I remember setting up the compiler plugin one of the gradle project and it worked
👌🏼 1