Multiplatform error: "Please initialize at least one Kotlin target"

I created a new multiplatform project. The gradle build file was more bare-bones than I remember, but I proceeded and manually created the folder src/jvmMain/kotlin and added some source files to it. Then I created a jvm and jvmMain sections in my build.gradle.kts:

kotlin {
    jvm { ... }
    sourceSets {
        val jvmMain by getting {
            dependencies { ... 

It all seemed to work; I was able to compile and run some Kotlin code. Then I restarted in IntelliJ and it again chokes and gives me this:

Please initialize at least one Kotlin target in ‘DemoProject’ (:)’.
Read more

That link is not helping - it leads to general MPP docs. I think I did set up a target, so what is it complaining about? Is the jvm block in the gradle file not initializing a target?

I think I’ve fixed this. My plugins section had both “jvm” and “multiplatform”.

plugins {
    kotlin("multiplatform") version "1.4.30"
    kotlin("jvm") version "1.4.30"

I think this happened because I had previously checked both “multiplatform” and “jvm” in the Project setup window in the IDE.

Is kotlin("jvm") needed now? I believe just kotlin("multiplatform") is enough.

It’s been a while but, yes, I think you only need one. My problem was that I had both lines in my build file.