Lena Stepanova
03/08/2021, 4:24 PMval doOnStartup = koin.get<() -> Unit>() // doOnStartup is a lambda which is implemented in Swift on iOS side
doOnStartup.invoke()
When I try running my Android project, it crashes with
org.koin.core.error.NoBeanDefFoundException: No definition found for class:'kotlin.jvm.functions.Function0'. Check your definitions!
If I remove those two lines, it runs fine. I see that I can remove this doOnStartup both from common Koin and iOS code, because in KampKit it doesn't do anything important.
But why doesn't it work in my project, but in KampKit it does?russhwolf
03/08/2021, 4:28 PMdoOnStartup
is just a sample to demo how you might inject arbitrary platform-specific logic. It's not actually doing anything important so you can definitely safely remote it.
As to why it's not working for you on Android, the error indicates that it's looking for something that's not there. Are you missing a () -> Unit
definition on the Android side? KaMPKit passes it here: https://github.com/touchlab/KaMPKit/blob/master/app/src/main/java/co/touchlab/kampkit/android/MainApp.kt#L24-L26Lena Stepanova
03/08/2021, 4:32 PM