Web target, it works with iOS, Android, desktop, b...
# multiplatform
s
Web target, it works with iOS, Android, desktop, but now my WASM is giving:
Copy code
Could not determine the dependencies of task ':kotlinNpmInstall'.
> Could not resolve all dependencies for configuration ':composeApp:wasmJsNpmAggregated'.
   > Could not resolve androidx.compose.runtime:runtime:1.7.3.
     Required by:
         project :composeApp
      > No matching variant of androidx.compose.runtime:runtime:1.7.3 was found. The consumer was configured to find a library for use during 'kotlin-runtime', preferably optimized for non-jvm, as well as attribute 'org.jetbrains.kotlin.js.public.package.json' with value 'public-package-json', attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm', attribute 'org.jetbrains.kotlin.wasm.target' with value 'js' but:

[see further details by clicking "reply" on Slack]
Also tried with
1.8.0-alpha03
of
androidx-compose-runtime
.
Copy code
Could not determine the dependencies of task ':kotlinNpmInstall'.
> Could not resolve all dependencies for configuration ':composeApp:wasmJsNpmAggregated'.
   > Could not resolve androidx.compose.runtime:runtime:1.8.0-alpha03.
     Required by:
         project :composeApp
      > No matching variant of androidx.compose.runtime:runtime:1.8.0-alpha03 was found. The consumer was configured to find a library for use during 'kotlin-runtime', preferably optimized for non-jvm, as well as attribute 'org.jetbrains.kotlin.js.public.package.json' with value 'public-package-json', attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm', attribute 'org.jetbrains.kotlin.wasm.target' with value 'js' but:
          - Variant 'androidxSourcesElements':
              - Incompatible because this component declares documentation for use during 'androidx-multiplatform-docs' and the consumer needed a library for use during 'kotlin-runtime'
              - Other compatible attributes:
                  - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                  - Doesn't say anything about org.jetbrains.kotlin.js.public.package.json (required 'public-package-json')
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'wasm')
                  - Doesn't say anything about org.jetbrains.kotlin.wasm.target (required 'js')
          - Variant 'jvmStubsApiElements-published' declares a library, preferably optimized for standard JVMs:
              - Incompatible because this component declares a component for use during compile-time, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a component for use during 'kotlin-runtime', as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm'
              - Other compatible attributes:
                  - Doesn't say anything about org.jetbrains.kotlin.js.public.package.json (required 'public-package-json')
                  - Doesn't say anything about org.jetbrains.kotlin.wasm.target (required 'js')
          - Variant 'jvmStubsRuntimeElements-published' declares a library for use during runtime, preferably optimized for standard JVMs:
              - Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm'
              - Other compatible attributes:
                  - Doesn't say anything about org.jetbrains.kotlin.js.public.package.json (required 'public-package-json')
                  - Doesn't say anything about org.jetbrains.kotlin.wasm.target (required 'js')
          - Variant 'jvmStubsSourcesElements-published' declares a component for use during runtime, preferably optimized for standard JVMs:
              - Incompatible because this component declares documentation, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm'
              - Other compatible attributes:
                  - Doesn't say anything about org.jetbrains.kotlin.js.public.package.json (required 'public-package-json')
                  - Doesn't say anything about org.jetbrains.kotlin.wasm.target (required 'js')
          - Variant 'libraryVersionMetadata':
              - Incompatible because this component declares documentation for use during 'library-version-metadata' and the consumer needed a library for use during 'kotlin-runtime'
              - Other compatible attributes:
                  - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                  - Doesn't say anything about org.jetbrains.kotlin.js.public.package.json (required 'public-package-json')
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'wasm')
                  - Doesn't say anything about org.jetbrains.kotlin.wasm.target (required 'js')
          - Variant 'linuxx64StubsApiElements-published' declares a library, preferably optimized for non-jvm:
              - Incompatible because this component declares a component for use during 'kotlin-api', as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native' and the consumer needed a component for use during 'kotlin-runtime', as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm'
              - Other compatible attributes:
                  - Doesn't say anything about org.jetbrains.kotlin.js.public.package.json (required 'public-package-json')
                  - Doesn't say anything about org.jetbrains.kotlin.wasm.target (required 'js')
          - Variant 'linuxx64StubsSourcesElements-published' declares a component for use during 'kotlin-runtime', preferably optimized for non-jvm:
              - Incompatible because this component declares documentation, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native' and the consumer needed a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm'
              - Other compatible attributes:
                  - Doesn't say anything about org.jetbrains.kotlin.js.public.package.json (required 'public-package-json')
                  - Doesn't say anything about org.jetbrains.kotlin.wasm.target (required 'js')
          - Variant 'metadataApiElements' declares a library, preferably optimized for non-jvm:
              - Incompatible because this component declares a component for use during 'kotlin-metadata', as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common' and the consumer needed a component for use during 'kotlin-runtime', as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm'
              - Other compatible attributes:
                  - Doesn't say anything about org.jetbrains.kotlin.js.public.package.json (required 'public-package-json')
                  - Doesn't say anything about org.jetbrains.kotlin.wasm.target (required 'js')
          - Variant 'metadataSourcesElements' declares a component for use during 'kotlin-runtime', preferably optimized for non-jvm:
              - Incompatible because this component declares documentation, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common' and the consumer needed a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm'
              - Other compatible attributes:
                  - Doesn't say anything about org.jetbrains.kotlin.js.public.package.json (required 'public-package-json')
                  - Doesn't say anything about org.jetbrains.kotlin.wasm.target (required 'js')
          - Variant 'releaseApiElements-published' declares a library, preferably optimized for Android:
              - Incompatible because this component declares a component for use during compile-time, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a component for use during 'kotlin-runtime', as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm'
              - Other compatible attributes:
                  - Doesn't say anything about org.jetbrains.kotlin.js.public.package.json (required 'public-package-json')
                  - Doesn't say anything about org.jetbrains.kotlin.wasm.target (required 'js')
          - Variant 'releaseRuntimeElements-published' declares a library for use during runtime, preferably optimized for Android:
              - Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm'
              - Other compatible attributes:
                  - Doesn't say anything about org.jetbrains.kotlin.js.public.package.json (required 'public-package-json')
                  - Doesn't say anything about org.jetbrains.kotlin.wasm.target (required 'js')
          - Variant 'releaseSourcesElements-published' declares a component for use during runtime, preferably optimized for Android:
              - Incompatible because this component declares documentation, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm'
              - Other compatible attributes:
                  - Doesn't say anything about org.jetbrains.kotlin.js.public.package.json (required 'public-package-json')
                  - Doesn't say anything about org.jetbrains.kotlin.wasm.target (required 'js')
   > Could not resolve androidx.lifecycle:lifecycle-viewmodel-compose:2.9.0-alpha04.
     Required by:
         project :composeApp
      > No matching variant of androidx.lifecycle:lifecycle-viewmodel-compose:2.9.0-alpha04 was found. The consumer was configured to find a library for use during 'kotlin-runtime', preferably optimized for non-jvm, as well as attribute 'org.jetbrains.kotlin.js.public.package.json' with value 'public-package-json', attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm', attribute 'org.jetbrains.kotlin.wasm.target' with value 'js' but:
          - Variant 'androidxSourcesElements':
              - Incompatible because this component declares documentation for use during 'androidx-multiplatform-docs' and the consumer needed a library for use during 'kotlin-runtime'
              - Other compatible attributes:
                  - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                  - Doesn't say anything about org.jetbrains.kotlin.js.public.package.json (required 'public-package-json')
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'wasm')
                  - Doesn't say anything about org.jetbrains.kotlin.wasm.target (required 'js')
          - Variant 'desktopApiElements-published' declares a library, preferably optimized for standard JVMs:
              - Incompatible because this component declares a component for use during compile-time, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a component for use during 'kotlin-runtime', as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm'
              - Other compatible attributes:
                  - Doesn't say anything about org.jetbrains.kotlin.js.public.package.json (required 'public-package-json')
                  - Doesn't say anything about org.jetbrains.kotlin.wasm.target (required 'js')
          - Variant 'desktopRuntimeElements-published' declares a library for use during runtime, preferably optimized for standard JVMs:
              - Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm'
              - Other compatible attributes:
                  - Doesn't say anything about org.jetbrains.kotlin.js.public.package.json (required 'public-package-json')
                  - Doesn't say anything about org.jetbrains.kotlin.wasm.target (required 'js')
          - Variant 'desktopSourcesElements-published' declares a component for use during runtime, preferably optimized for standard JVMs:
              - Incompatible because this component declares documentation, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm'
              - Other compa
d
Sounds like your common source set depends on an android specific dependency.
What are your trying to achive?
s
Very simple application with only barcode scanning in an `expect`/`actual` . Here is my full `libs.versions.toml`:
Copy code
[versions]
agp = "8.7.1"
android-compileSdk = "34"
android-minSdk = "24"
android-targetSdk = "34"

androidx-activity-compose = "1.10.0-alpha02"
androidx-appcompat = "1.7.0"
androidx-constraintlayout = "2.1.4"
androidx-core-ktx = "1.13.1"
androidx-espresso-core = "3.6.1"
androidx-jetbrains-lifecycle-viewmodel = "2.9.0-dev1875"
androidx-lifecycle-viewmodel = "2.9.0-alpha04"
androidx-material = "1.13.0-alpha06"
androidx-material3 = "1.4.0-alpha01"
androidx-test-junit = "1.2.1"
coilCompose = "3.0.0-rc01"
compose-plugin = "1.8.0-dev1875"
coroutines = "1.9.0"
decompose = "3.2.0-beta02"
kotlin = "2.0.20"
kotlinx-coroutines = "1.9.0"
kotlinxDatetime = "0.6.1"
ktor = "3.0.0"
lifecycle = "2.2.0-beta01"
playServicesCodeScanner = "16.1.0"

[libraries]
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity-compose" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidx-appcompat" }
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "androidx-constraintlayout" }
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidx-core-ktx" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "androidx-espresso-core" }
androidx-material = { group = "com.google.android.material", name = "material", version.ref = "androidx-material" }
androidx-material3 = { group = "com.google.android.material", name = "material3", version.ref = "androidx-material3" }
androidx-test-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidx-test-junit" }
coil-network-ktor3 = { module = "io.coil-kt.coil3:coil-network-ktor3", version.ref = "coilCompose" }
coil3-coil-compose = { module = "io.coil-kt.coil3:coil-compose", version.ref = "coilCompose" }
decompose = { module = "com.arkivanov.decompose:decompose", version.ref = "decompose" }
decompose-extensions-compose = { module = "com.arkivanov.decompose:extensions-compose", version.ref = "decompose" }
jetbrains-lifecycle-viewmodel = { module = "org.jetbrains.androidx.lifecycle:lifecycle-viewmodel", version.ref = "androidx-jetbrains-lifecycle-viewmodel" }
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
kotlinx-coroutines-swing = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-swing", version.ref = "kotlinx-coroutines" }
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinxDatetime" }
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
ktor-client-content-negotiation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktor" }
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-client-darwin = { module = "io.ktor:ktor-client-darwin", version.ref = "ktor" }
ktor-client-js = { module = "io.ktor:ktor-client-js", version.ref = "ktor" }
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
lifecycle = { module = "com.arkivanov.essenty:lifecycle", version.ref = "lifecycle" }
lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel", version.ref = "androidx-lifecycle-viewmodel" }
lifecycle-viewmodel-compose = { module = "org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "androidx-jetbrains-lifecycle-viewmodel" }
play-services-code-scanner = { module = "com.google.android.gms:play-services-code-scanner", version.ref = "playServicesCodeScanner" }

[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
androidLibrary = { id = "com.android.library", version.ref = "agp" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlinSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
And my full
build.gradle.kts
subsection:
Copy code
kotlin {
    sourceSets {
        val desktopMain by getting

        all {
            languageSettings.optIn("kotlinx.cinterop.ExperimentalForeignApi")
        }
        
        androidMain.dependencies {
            implementation(compose.preview)
            implementation(libs.androidx.activity.compose)
            implementation(libs.play.services.code.scanner)
            implementation(libs.ktor.client.okhttp)
            implementation(libs.kotlinx.coroutines.android)
        }
        iosMain.dependencies {
            implementation(libs.ktor.client.darwin)
            implementation(libs.lifecycle)
        }
        desktopMain.dependencies {
            implementation(compose.desktop.currentOs)
            implementation(libs.kotlinx.coroutines.swing)
            implementation(libs.ktor.client.cio)
        }
        jsMain.dependencies {
            implementation(libs.ktor.client.js)
        }
        commonMain.dependencies {
            implementation(compose.runtime)
            implementation(compose.foundation)
            implementation(compose.material)
            implementation(compose.material3)
            implementation(compose.ui)
            implementation(compose.components.resources)
            implementation(compose.components.uiToolingPreview)
            // implementation(libs.androidx.lifecycle.viewmodel)
            // implementation(libs.androidx.lifecycle.runtime.compose)
            // runtimeOnly(libs.androidx.runtime)
            implementation(libs.coil.network.ktor3)
            implementation(libs.ktor.client.core)
            implementation(libs.kotlinx.coroutines.core)
            implementation(libs.ktor.client.content.negotiation)
            implementation(libs.ktor.serialization.kotlinx.json)
            implementation(libs.coil3.coil.compose)

            implementation(libs.decompose)
            implementation(libs.decompose.extensions.compose)
            // runtimeOnly(libs.androidx.lifecycle.viewmodel.compose)
            implementation(libs.kotlinx.datetime)
            runtimeOnly(libs.lifecycle.viewmodel)
            implementation(libs.jetbrains.lifecycle.viewmodel)
            implementation(libs.lifecycle.viewmodel.compose)
        }
    }
}
Here is a repo that reproduces this bug: https://github.com/SamuelMarks/bug-repo-kmp