https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
j

Jeff Lockhart

02/27/2021, 7:07 PM
I'm using Koin
api("org.koin:koin-core:3.0.0-alpha-4")
and when I add Ktor
implementation("io.ktor:ktor-client-core:1.5.2")
to my build.gradle.kts, all the Koin
org.koin.*
imports start showing errors “Unresolved reference” in Android Studio 4.2-beta5. This is in a shared KMM module. My app compiles and runs without error. But why the IDE errors?
j

John Oberhauser

02/27/2021, 7:19 PM
I might try going to file -> invalidate caches and restart. That can sometimes fix weird issues like this
j

Jeff Lockhart

02/27/2021, 7:57 PM
I did try that actually, but errors came back after the indexes were rebuilt after restart. I might try clearing some of the other gradle caches as well.
Errors still come back after clearing the local and global .gradle caches as well.
v

Vlad Ivanov

02/27/2021, 9:38 PM
The same problem with kotlinx.datetime and some random stuff from coroutines. AS Arctic Fox (canary8), kotlin 1.4.30 Cache invalidation/ IDE restart don't help.
j

Jeff Lockhart

02/27/2021, 10:30 PM
Ah, yes I do see errors on kotlinx-datetime imports too, same as Koin.
n

Neal Sanche

02/28/2021, 2:00 AM
I had strange errors like this until I actually set the JDK in project settings to the actual location of my JDK.
k

KamilH

02/28/2021, 8:19 AM
I’m having the same problem with
Kodein
. All its imports are “Unresolved reference”, but app compiles and runs fine. I’m using it in simple server app (no multiplatform one). This makes me think that it must be some kind of general problem. I’m using IntelliJ IDEA 2020.3.2 (Community Edition)
✔️ 1
j

Jeff Lockhart

02/28/2021, 8:28 AM
Oddly, the errors went away for a short while. When I attempted to revert some changes I’d made, the errors came back after restarting Android Studio. And now after reapplying the changes, the errors continue (at least for now). I have noticed an error like this show up in the event log a couple times after restarting Android Studio:
Copy code
1:00 AM	Incompatible Kotlin/Native libraries
				There are 4 third-party libraries attached to the project that were compiled with an older Kotlin/Native compiler and cant be read in IDE:
				Gradle: org.jetbrains.kotlinx:kotlinx-datetime-metadata:darwinMain:0.1.1
				Gradle: org.jetbrains.kotlinx:kotlinx-datetime-metadata:nativeMain:0.1.1
				Gradle: org.koin:koin-core-metadata:darwinMain:3.0.0-alpha-4
				Gradle: org.koin:koin-core-metadata:nativeMain:3.0.0-alpha-4
				Please edit Gradle buildfile(s) and specify library a version compatible with Kotlin/Native 1.4.31. Then re-import the project in IDE.
But it doesn’t always have all the same libraries in the list and the event doesn’t always show either. The fact that at least sometimes, both Koin and kotlinx-datetime show up here, leads me to believe this likely has something to do with the errors though. Maybe Android Studio just takes longer to silently index and process these libraries. Guess I’ll see if the errors go away again and hopefully new builds of Koin and kotlinx-datetime soon.
4 Views