Hi! I'm starting out with multiplatform, but IDEA ...
# multiplatform
g
Hi! I'm starting out with multiplatform, but IDEA is pointing out usages of java packages in my code as unresolved references, even though the project compiles (any
java.*
reference). Has anyone run into this?
This is my module’s build script:
Copy code
plugins {
    id("org.jetbrains.kotlin.multiplatform")
}
repositories {
    mavenCentral()
}

kotlin {
    jvm()
    sourceSets {
        val commonMain by getting {
            dependencies {
                implementation(kotlin("stdlib-common"))
            }
        }
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test-common"))
                implementation(kotlin("test-annotations-common"))
            }
        }
        val jvmMain by getting {
            dependsOn(commonMain)
            dependencies {
                implementation(kotlin("stdlib-jdk8"))
            }
        }
        val jvmTest by getting {
            dependencies {
                implementation(kotlin("test"))
                implementation(kotlin("test-junit"))
            }
        }
    }
}
r
You don't need
dependsOn(commonMain)
in
jvmMain
. That might be confusing the IDE.
g
@russhwolf, thanks, that was added by the IDE template. I removed it, but still no luck
s
What versions Kotlin (Gradle Plugin, IDE Plugin) are you currently using?
g
Kotlin plugin for Gradle: 1.3.50 Kotlin plugin for IDEA: 1.3.60-release-IJ2019.2-1 IDEA Ultimate 2019.2.4
r
Oh interesting if it's in the template then that's new.
s
Try upgrading to gradle 1.3.60. We have seen so many MPP issues being resolved with 1.3.60
(We are using it since the first eap. Works really well ☺️ )
e
I've seen some weirdness where Java classes can't be found in the IDE. Haven't digged into too much, but I've found that changing the Java version in Project Settings usually does the trick.
It seems to keep changing my target Java version to 11, which is at odds with the Gradle configuration, which is set to 8. When I set it back to 8, it magically starts working again.
g
@russhwolf @Sebastian Sellmair [JB] @Erik Christensen Thank you all! I think changing my target Java version is what did it, which is weird because I didn’t have this set in Gradle at all, so IDEA should be working with version 11, but it started working once I changed it to version 8