Hey everyone! Running into a weird KMP issue that'...
# library-development
m
Hey everyone! Running into a weird KMP issue that's got me stumped. I've tried clean builds with refresh dependencies, invalidating IDE cache - nothing's working. Setup: • 3 KMP libraries, all on Kotlin 2.2.0 + Compose 1.8.2 • Publishing to private GitHub repo • 2 libraries have iOS targets commented out, 1 has them active (via convention plugin) • CI uses Ubuntu runners so iOS binaries aren't published (intentional) Convention plugin config: kotlin
Copy code
import org.gradle.accessors.dm.LibrariesForLibs
plugins {
  id("com.android.kotlin.multiplatform.library")
  id("id-cmp")
}
val libs = the<LibrariesForLibs>()
kotlin {
  jvm("desktop")
//  iosX64()
//  iosArm64()
//  iosSimulatorArm64()
  androidLibrary {
    experimentalProperties["android.experimental.kmp.enableAndroidResources"] = true
    compileSdk = libs.versions.android.compileSdk.get().toInt()
    minSdk = libs.versions.android.minSdk.get().toInt()
  }
}
The Problem: For the 2 libraries WITHOUT iOS targets - when I try to import them in feature modules of separate apps, I can't access anything from
commonMain
. However, I CAN access them from
androidMain
and
desktopMain
source sets. Plot twist: The same applications can access classes/packages from their own
composeApp
modules just fine. Anyone seen this before or have ideas? Is this a known KMP issue with partial target configurations?
c
What's
id-cmp
?
m
Its a build script that applies compose multiplatform dependencies:
plugins {
id("id-kmp")
org.jetbrains.compose
kotlin-composecompiler
}
val libs = the<LibrariesForLibs>()
kotlin {
jvm("desktop") {
attributes.attribute(
org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType.attribute,
org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType.jvm,
)
}
sourceSets {
androidMain.dependencies { implementation(compose.preview) }
commonMain.dependencies {
implementation(compose.components.uiToolingPreview)
implementation(compose.foundation)
implementation(compose.material3)
implementation(compose.runtime)
implementation(compose.ui)
implementation(compose.components.resources)
implementation(compose.uiUtil)
implementation(compose.materialIconsExtended)
implementation(libs.compose.backhandler)
// This was removed from the main compose multiplatform plugin
implementation(libs.material.icons.core)
}
}
}
On this, i think its an issue with Kotlin Multiplatform not supporting single targets: https://youtrack.jetbrains.com/issue/KT-69135/KMP-publications-with-a-single-jvm-target-do-not-publish-metadataBinary