Issue
I've been trying to set up a new Kotlin project in IntelliJ IDEA, using the default IntelliJ Build System (not Gradle) and JDK 15. Whenever it creates the default main.kt file, and I try to build and run the main function, which looks like this:
fun main(args: Array<String>) {
println("Hello World!")
}
the build fails after a short time with the following errors:
Kotlin: Cannot access built-in declaration 'kotlin.Array'. Ensure that you have a dependency on the Kotlin standard library
Kotlin: Cannot access built-in declaration 'kotlin.String'. Ensure that you have a dependency on the Kotlin standard library
and
Kotlin: Unresolved reference: println
I've tried changing the project SDK to the kotlin SDK, to Java 14 and to Java 1.8. I'm not sure exactly how to add the dependency it asks for. Any help is appreciated.
This is what the dependencies window shows within the project:
Right now the project is using JDK 15, and Kotlin 1.4.10. I've tried updating the plugin, uninstalling and reinstalling, deactivating and reactivating, all to no avail.
The project files can be found here on Google Drive
Solution
Removing the .idea/library file inside the project directory and then selecting "use library from plugin" when prompted to configure Kotlin files by the IDE solved the problem.
Answered By - A. P. Roblem
Answer Checked By - David Marino (JavaFixing Volunteer)