https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
a

Animesh Sahu

12/01/2020, 8:10 AM
Something weird is happening with me. The commonMain seems to have "kotlin not configured" error while the other modules have no problems for it... Any idea?
build.gradle.kts (root)
Copy code
plugins {
    kotlin("multiplatform") version "1.4.20" apply false
}

allprojects {
    this.group = "com.github.animeshz"
    this.version = "0.0.1"

    repositories {
        mavenCentral()
        jcenter()
    }
}

subprojects {
    apply(plugin = "kotlin-multiplatform")
}
build.gradle.kts (in common module)
Copy code
@file:Suppress("UNUSED_VARIABLE")

kotlin {
    linuxX64()
    mingwX64()

    sourceSets {
        val commonMain by getting {
            dependencies {
                implementation(kotlin("stdlib-common"))
                implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2")
//                implementation("io.github.microutils:kotlin-logging:2.0.2")
            }
        }
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test-common"))
                implementation(kotlin("test-annotations-common"))
                implementation("io.kotest:kotest-assertions-core:4.3.1")
//                implementation("io.kotest:kotest-property:4.3.1")
            }
        }

        val linuxX64Main by getting {
            dependsOn(commonMain)
        }
        val mingwX64Main by getting {
            dependsOn(commonMain)
        }

        all {
            languageSettings.useExperimentalAnnotation("kotlin.RequiresOptIn")
        }
    }

    explicitApi()
}
build.gradle.kts (in specific module having problem)
Copy code
kotlin {
    linuxX64()
    mingwX64()

    sourceSets {
        val commonMain by getting {
            dependencies {
                api(project(":common"))
            }
        }
        val commonTest by getting {}

        val linuxX64Main by getting {
            dependsOn(commonMain)
        }
        val mingwX64Main by getting {
            dependsOn(commonMain)
        }
    }

    explicitApi()
}
Solved: I actually had to use
api()
instead of
implementation()
to expose the common dependency to all of the submodules having it as a dependency...