Fresh download of IdeaC on Mac fails to build Kotlin Hello World app

已回答

I decided to try Kotlin and Idea on a MacOS 12.5.1.

  1. I downloaded the Community IdeaC 2022.2.2
  2. I selected Kotlin as the language type and created a new project.
  3. The project has a Main.kt that prints "Hello World". I did not modify the generated code.
  4. I selected "Run Main.kt" from the Run menu.

EXPECTED: app to run and print "Hello World".

ACTUAL: It failed to build. Error message was:

    Kotlin: Cannot access built-in declaration 'kotlin.Array'. Ensure that you have a dependency on the Kotlin standard library

This not a great first experience and seems like a bug in the installation wizard.

 

0

I think this should be fixed in the installer. But I found a possible workaround.

  1. Open "Project Structure..." from the File menu.
  2. Click on SDSs
  3. Click on Kotlin. Note the SDK path is empty!
  4. Click the "+" icon.
  5. Navigate into "Applications/IntelliJ IDEA CE.app/Contents/plugins" folder
  6. Select Kotlin
  7. Click Open

That opened the SDK and I was able to build and run Hello World.

I suspect most beginning users would not figure that out.

 

0

Do you have the same problem with a Java project? Can you attach a screenshot of the 'New project' window when you trying to create Kotlin project?

0

Hello, I tryed make like Burkphil, but it didn't help me,

Previosly I used coretto-1.8, it alos didn't worked. But Java prject work normally, how I can fix it? if I already reinstall IDEA more than 5 times

0

请先登录再写评论。