Kotlin unresolved reference in IntelliJ

Anony-mouse picture Anony-mouse · Jul 30, 2015 · Viewed 142.8k times · Source

I started off with the tutorial for learning Kotlin in IntelliJ.When I tried running the example i.e

fun main(args: Array<String>) {
 println("lol")
}

Execution is suspended with this messageError:(5, 5) Kotlin: Unresolved reference: println This is the first time I am using IntelliJ.I have never worked on a Java project either.Am I missing something?

Edit:I have seen the other question already.The answer is not valid for my situation.

Answer

Jayson Minard picture Jayson Minard · Jan 6, 2016

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, you'll 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).