Is it expected that most things in Intellij/AS wil...
# multiplatform
e
Is it expected that most things in Intellij/AS will be highlighted in red yet compile fine? For instance, anything used from a multiplatform library (coroutines, serialization, etc...) has an unresolved error, and pretty much every line in my gradle.kts files are red and say "Cannot access".
🚫 1
🙌 1
s
No this is not expected anymore. Many of those issues shall be fixed by now (at least in eap’s, etc). May I ask which version of IntelliJ/Android Studio / Kotlin Gradle Plugin / Kotlin IDE plugin you’re using?
e
Intellij 2020.3.2 Android Studio 2020.3.1 Alpha 8 Kotlin Gradle Plugin 1.4.30 Kotlin IDE Plugin Intellij 1.4.31 Kotlin IDE Plugin Android Studio 1.4.30 I cleaned up the JDKs for the project, and all of the gradle.kts issues cleared up, but any common code that's referencing coroutines, atomicfu, serialization, etc... still has unresolved reference errors (but I can build and run the project).
s
Hmm, I see. Would you be open for a Google Meet session with me, to see what is going on?
e
Sure, but if it's easier I can also share the code (I'm putting it in on GitHub publicly soon)
👍 1
b
did you try Tools > Kotlin > Configure Kotlin in project? it did the trick for me before
e
I removed
kotlin.mpp.enableGranularSourceSetsMetadata=true
from gradle.properties and now the unresolved reference errors went away
s
No, this should still not happen. I will checkout your project with the current master of intellij and Kotlin to see if there is something going on. In general, HMPP should work pretty well for most cases and you can send me any case where you experience issues with as DM.
👍 1
I checked out your project and there are two things that might help you: 1. Please upgrade your Kotlin Gradle plugin from 1.4.30 to 1.4.31 to mitigate https://youtrack.jetbrains.com/issue/KT-44845 2. Using java APIs in commonMain is not only a bad practice, but it is not supported by most Kotlin-IDE plugin builds (even if you’re only targeting jvm)
The file you mentioned resolved fine after upgrading Kotlin
e
That looks like it's working for me. Thanks! The java API in commonMain has bit me a few times now. I'm surprised that there wasn't an error or a warning that I shouldn't use it.
s
If you’re just having a single target, then commonMain will also support this target. It does not necessarily break anything. It’s just annoying once you want to add a second target that is not jdk compatible.
e
Do you know if this issue would happen in Android Studio Arctic Fox even after updating to 1.4.31?
Now it stopped working in Intellij again. Also when
kotlin.mpp.enableGranularSourceSetsMetadata
is enabled, multiplatform dependencies are not resolving correctly.
s
Did you try invalidating caches and restart already? For multiplatform, I would not recommend using Android Studio at the moment, tbh 😢
e
I've put that project away for now because work picked up, but I'll reinvestigate when I pick it up again. I used to find that to be the case, but lately I use Android Studio alpha because it seems to be more stable, and I switch to Intellij if I need a wizard, etc...