Hi, I've spent the whole day trying to understand ...
# koin
l
Hi, I've spent the whole day trying to understand why I suddenly get org.koin unresolved error. I think, after I changed dependencies some time ago to io.insert-koin, the project kept working on cached libraries. Today I invalidate the caches and cannot use KoinComponent anymore. It's a Kotlin Multiplatform project. I would really appreciate any help! Funnily, the project builds and runs from develop branch, but doesn't from another working branch. And I'm sure I haven't done anything to koin or other dependencies there 🤯
a
Hi, did you reimport the project, clean your .gradle cache also ?
does it compile from terminal?
l
What do you mean by reimporting the project? I tried cleaning the cache, the project, deleting gradle folder ./gradlew clean build fails with Unresolved reference: KoinComponent However, the moment when I switch to an older branch, I can build and run it again
a
did you change the version, or did you just updated the groupId from
org.koin
to
io.insert-koin
?
as it’s the same version, the API should stay the same
l
Increased the version from 3.0.0-alpha-4 to 3.0.1
a
However, the moment when I switch to an older branch, I can build and run it again
ok, because the local build is still the same gradle config
ok, weird. You can even work with 3.0.2
your project was in 3.0.0 alpha?
l
Yes, it was 3.0.0-alpha-4 Tried 3.0.2, but it's the error is the same
a
3.0.0 is quite “old”, and there were some breakings API. Put yourelf in 3.0.2
and perhaps try to remove import of Koin
and reimport things
Yep, this is it. Just reimport things. The KoinComponent was breaking in 2.2.2 and 3.0.0. It has been move to:
Copy code
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
org.koin.core.component
package
l
Yep, I've changed the imports from org.koin.core to or.coin.core.component right after changing the groupId and the version
I invalidated caches in the branch where I increased the version and get now the same error
When I start typing import org... I don't even see the koin package suggestion
But the libraries are there
Tried again and it worked 😐 AS still shows koin as unresolved, but the project runs. I had such behaviour before, but this time was extremely weird. Anyway, thanks! @arnaud.giuliani
a
yes really weird, wha&t version of AS do you use?
l
4.1 rc3 gradle 6.5 gradle plugin 3.6.3
a
I believe your gradle version can be a bit old (many meta data stuff in last 6.7 and other versions)
try with a recent AS 4.2 config if you can
l
I'll give it a go when I have time 🙂 Upgrading the gradle plugin gave me other problems, so I decided to stick with what's working for now
a
there is some days like that 😄 good that you can continue despite those problems
👍 1
KMM is sometimes a bit
magical
l
True 🙂