问题描述
我开始使用以<$ c $学习Kotlin c> IntelliJ 。当我尝试运行示例时,
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")
}
暂停执行使用此消息错误:(5,5)Kotlin:未解决的参考:println
这是我第一次使用IntelliJ.I从未使用过 Java
项目。我遗失了什么?
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?
编辑:我见过其他已经答案对我的情况无效。
I have seen the other question already.The answer is not valid for my situation.
推荐答案
您在项目中使用的Intellij IDEA插件和Kotlin运行时/编译器需要匹配。例如,如果IDE插件是Beta 1,但是使用M12的Gradle / Maven项目,则会出现与您所描述的完全相同的问题。因此请检查所有内容是否排成一行。
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.
如果仍有问题,使用一些较旧的插件则需要清除Intellij IDEA中的缓存(文件菜单,清除缓存和重启,选择重启的选项。)
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).
这篇关于Kotlin未解决IntelliJ中的参考问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!