Unable to run Kotlin project pulled from Git in IDEA


#1

Hi,
I’m very new to Kotlin. Yesterday, I’d pushed a Kotlin project (only source files - excluding .idea folder) into a Git repository. Here is the link: https://github.com/sbaitmangalkar/kotlin-starter.git. When I pulled out the same in a different machine and opened it up in IDEA, the project is no longer run-able. Here is the sample screenshot of IDEA:

I also tried adding Kotlin Runtime Library. Am I on the wrong path here or am I missing something?


#2

After hours of struggle, I finally figured out the solution. Here is a step-by-step approach which I took in order to solve this.This might come in handy for people who might face similar issues

  1. After opening the project IDEA IntelliJ, a .idea folder will be added to the working directory. This folder has a .iml file. Open it and enclose

    within tag. This will be missing by default.
    Note: if source code is not within src, provide the relevant directory name.

  2. Go to project settings and add “Project SDK” and also set “Project compiler output folder”. Ideally this will be **/out directory. As the code is pulled from version control, “out” directory will be absent by default. So go ahead and create one under the working directory and set it as the “Project compiler output folder”.

  3. Rebuild the project.

Now, one should be able to run the code.