Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

jvm - Kotlin unresolved reference in IntelliJ

I started off with this tutorial for learning Kotlin in IntelliJ IDEA.
When I tried running the following example,

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

Build fails with the following error:

Error:(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 already seen this other question, though it is not valid for my situation.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...