I'm trying to pull in elements of KaMP Kit into a ...
# touchlab-tools
t
I'm trying to pull in elements of KaMP Kit into a new project so I can understand all of the parts. Right now I'm struggling with adding Koin and Kermit. When I try to add the line to my main activity that injects the logger like in KaMP Kit, it fails to resolve injectLogger(). I have the line where the injectLogger method is added to KoinComponent, but it won't use it. The error states that none of the following candidates is applicable because of receiver type mismatch. Is there some kotlin setting that I have missed?
m
Can you add some screenshots/code snippets of your setup? Hard to be sure whats going on without seeing your project but from what you’ve described i think a good thing to check would to to make sure you have koin and kermit dependencies in your
shared
module declared with
api(…kermi/koin)
instead of
implementation(…kemrit/koin)
so that they get exposed to your android module as well
t
Here I am trying to use the injectLogger extension that the KaMP kit project uses. I even copied it into this file so I could be sure that it sees it. You can see that Android Studio doesn't think the method is applicable. I'm going to add a screen shot too.
message has been deleted
KaMP kit doesn't require koin to use api, but I even switched it from implementation to api as you suggested.
m
I think you just need to have
MainActivity
implement
KoinComponent
since thats what the extension is on.
ComponentActivity
is from android and unrelated to koin so i definitely see the confusion
t
Doh! That was it. I totally missed that interface declaration. Thanks!
m
No problem! I didnt notice it either and just assumed ComponentActivity came from koin as a nice helper but then saw kampkit uses both.