I am having a problem where IntelliJ does not reco...
# multiplatform
m
I am having a problem where IntelliJ does not recognise the Android source sets in my KMP project. If I have a common and an Android source set, neither are displayed as code in the the IDE and everything is just treated the same as any other text. If I however add a JVM source set for example, commonMain and jvmMain get displayed properly (while androidMain is still just a normal folder). I am writing a library and can build and publish the built Android artifacts just fine, yet the IDE doesn't realise that it is working code. I configure the source sets like this:
Copy code
kotlin {
    //jvm()

    androidTarget {
        publishLibraryVariants("release", "debug")
    }

    sourceSets {
        val commonMain by getting {
            dependencies {
                implementation(libs.napier)
                implementation(libs.kotlinx.datetime)
                implementation(libs.ktor.server.core)
                implementation(libs.ktor.server.cio)
                implementation(libs.ktor.server.resources)
                implementation(libs.ktor.server.contentnegotiation)
                implementation(libs.ktor.server.websockets)
                implementation(libs.ktor.serialization.json)
                implementation(libs.meshwrapper)
            }
        }

        val androidMain by getting {
            dependencies {
                implementation(libs.slf4j.api)
                implementation(libs.slf4j.simple)
            }
        }
    }
}
Is there a way I can get IntelliJ to recognise the androidMain source set?
p
have you applied the android plugin?
m
I have applied the Kotlin Multiplatform plugin and the Android library plugin, yes. The library does build successfully too and I can use it in another project just fine.
a
im also getting this issue where the androidMain and androidUnitTest source sets are not recognised in intellij
they are working in gradle