Hey <@U2JKKPMEE>. Could you kindly take a look at ...
# koin
r
Hey @arnaud.giuliani. Could you kindly take a look at this issue from my open source library? It is related with Koin annotations and it seems like there may be an issue when using other KSP libraries. I would like to get to the bottom of this, also be sure that it is not something I’m doing wrongly on my side. https://github.com/raamcosta/compose-destinations/issues/89
First I wanted to confirm, is this message
Copy code
org.koin.core.error.NoBeanDefFoundException: |- No definition found for class:'com.xxxx.ui.screen.test.TestScreenViewModel'. Check your definitions!
expected if there is any issue in that
TestScreenViewModel
? For example if it internally uses another generated class from another KSP library? 👀 It’s just a wild guess, but yeah.
a
this just means that your should have a definition for
TestScreenViewModel
after that, just be sure that you include generated modules when starting Koin
r
How could we do that? Is there a way to prioritise generation tasks? This error happens when the developer uses a class that is generated by other library that also uses KSP, inside the koin annotated ViewModel.
a
Need to dig in 🤔
r
I have not tried this myself, I also wonder if this only happens the first time after a clean build. Because after KSP runs once for my library, i would expect things to work for all other times, since my generated Class should already be generated..
a
do you have a sample app?
r
My library git repo does, but it's not using koin. I'd have to include it to try
This was reported from a user of the library
If you want I can prepare a branch with it though.. maybe later today when I get some time
a
yes, it would save me good time if you can prepare a branch with it 👍
👍 1
r
Will do then, I'll let you know here when I do.
@arnaud.giuliani In my sample it seems to be working fine 🤷 I do have another issue though: how do I pass the bundle arguments to the ViewModel construction so that they’re available from SavedStateHandle?
I’ve tried the deprecated getStateViewModel as it seemed to be what I wanted but then I get this error:
java.lang.ClassCastException: androidx.navigation.NavBackStackEntry cannot be cast to android.content.ComponentCallbacks
I found the PR where this support is to be added (I believe), took the chance to review it and made a comment