jvm - Kotlin unresolved reference in IntelliJ

jvm – Kotlin unresolved reference in IntelliJ

jvm – Kotlin unresolved reference in IntelliJ

Your Intellij IDEA plugin and the Kotlin runtime/compiler that you use in the project need to match. For example if IDE plugin is Beta 1, but your Gradle/Maven project using M12, youll have issues exactly as you described. So check that everything lines up.

If you still have issues, with some older plugins you need to clear the caches in Intellij IDEA (file menu, Clear Caches and Restart, select option to restart).

UPDATE – 01/2022

The jetbrains thread regarding this issue has moved and is nowhere to be found, so the link below is not valid anymore.

The option, per module, Kotlin -> FIX does not exist anymore and has been that way for years now since this was a temporary patch to deal with integration issues during the early previous releases.


If anyone stumbles across this and NEITHER Invalidate Cache or Update Kotlins Version work:

  1. First, make sure you can build it from outside the IDE. If youre using gradle, for instance:

    gradle clean build

If everything goes well , then your environment is all good to work with Kotlin.

  1. To fix the IDE build, try the following:

Project Structure -> {Select Module} -> Kotlin -> FIX

As suggested by a JetBrains member here: https://discuss.kotlinlang.org/t/intellij-kotlin-project-screw-up/597

jvm – Kotlin unresolved reference in IntelliJ

In my case, it was a misconfigured IntelliJ instance.

Project Structure -> SDKs -> Remove and add the Java SDK again

Related posts on jvm :

Leave a Reply

Your email address will not be published.