JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.17k stars 1.11k forks source link

compile WasmJs FAILED #4806

Closed KevinnZou closed 1 month ago

KevinnZou commented 1 month ago

Describe the bug Encountered an compilation error when compiling a WASM/JS target

Affected platforms

Versions kotlin.version=1.9.23 agp.version=8.1.1 compose.version=1.6.1 coroutines.version=1.8.0

Stacktrace

Task :sample:shared:compileDevelopmentExecutableKotlinWasmJs FAILED e: Module "org.jetbrains.compose.foundation:foundation" has a reference to symbol org.jetbrains.skiko/SkikoKey.platformKeyCode.|(){}[0]. Neither the module itself nor its dependencies contain such declaration.

This could happen if the required dependency is missing in the project. Or if there is a dependency of "org.jetbrains.compose.foundation:foundation" that has a different version in the project than the version that "org.jetbrains.compose.foundation:foundation" was initially compiled with. Please check that the project configuration is correct and has consistent versions of all required dependencies.

The list of "org.jetbrains.compose.foundation:foundation" dependencies that may lead to conflicts:

  1. "kotlin" (a library with unknown version)
  2. "co.touchlab:kermit" (a library with unknown version)
  3. "co.touchlab:kermit-core" (a library with unknown version)
  4. "com.benasher44:uuid" (a library with unknown version)
  5. "components.resources:library" (a library with unknown version)
  6. "compose-webview-multiplatform.sample:shared" (a library with unknown version)
  7. "compose-webview-multiplatform:webview" (a library with unknown version)
  8. "org.jetbrains.androidx.core:core-bundle" (a library with unknown version)
  9. "org.jetbrains.androidx.lifecycle:lifecycle-common" (a library with unknown version)
    1. "org.jetbrains.androidx.lifecycle:lifecycle-runtime" (a library with unknown version)
    2. "org.jetbrains.androidx.lifecycle:lifecycle-runtime-compose" (a library with unknown version)
    3. "org.jetbrains.androidx.lifecycle:lifecycle-viewmodel" (a library with unknown version)
    4. "org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-compose" (a library with unknown version)
    5. "org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-savedstate" (a library with unknown version)
    6. "org.jetbrains.androidx.navigation:navigation-common" (a library with unknown version)
    7. "org.jetbrains.androidx.navigation:navigation-compose" (a library with unknown version)
    8. "org.jetbrains.androidx.navigation:navigation-runtime" (a library with unknown version)
    9. "org.jetbrains.androidx.savedstate:savedstate" (a library with unknown version)
    10. "org.jetbrains.compose.animation:animation" (a library with unknown version)
    11. "org.jetbrains.compose.animation:animation-core" (a library with unknown version)
    12. "org.jetbrains.compose.annotation-internal:annotation" (a library with unknown version)
    13. "org.jetbrains.compose.collection-internal:collection" (a library with unknown version)
    14. "org.jetbrains.compose.foundation:foundation" (a dependency of the library with unknown version or versions mismatch: "org.jetbrains.compose.foundation:foundation")
    15. "org.jetbrains.compose.foundation:foundation-layout" (a library with unknown version)
    16. "org.jetbrains.compose.material:material" (a library with unknown version)
    17. "org.jetbrains.compose.material:material-icons-core" (a library with unknown version)
    18. "org.jetbrains.compose.material:material-ripple" (a library with unknown version)
    19. "org.jetbrains.compose.runtime:runtime" (a library with unknown version)
    20. "org.jetbrains.compose.runtime:runtime-saveable" (a library with unknown version)
    21. "org.jetbrains.compose.ui:ui" (a library with unknown version)
    22. "org.jetbrains.compose.ui:ui-geometry" (a library with unknown version)
    23. "org.jetbrains.compose.ui:ui-graphics" (a library with unknown version)
    24. "org.jetbrains.compose.ui:ui-text" (a library with unknown version)
    25. "org.jetbrains.compose.ui:ui-unit" (a library with unknown version)
    26. "org.jetbrains.compose.ui:ui-util" (a library with unknown version)
    27. "org.jetbrains.skiko:skiko" (a library with unknown version)
    28. "voyager:voyager-core" (a library with unknown version)
    29. "voyager:voyager-navigator" (a library with unknown version)
    30. "voyager:voyager-tab-navigator" (a library with unknown version)
    31. "org.jetbrains.kotlinx:atomicfu" (a library with unknown version)
    32. "org.jetbrains.kotlinx:kotlinx-coroutines-core" (a library with unknown version)
    33. "org.jetbrains.kotlinx:kotlinx-serialization-core" (a library with unknown version)
    34. "org.jetbrains.kotlinx:kotlinx-serialization-json" (a library with unknown version)
eymar commented 1 month ago

It seems like your project has a dependency on a library which depends on a newer skiko version, while your project depends on older skiko. Newer skiko doesn't have the missing symbol anymore - it's epxected.

Could you please try a new Compose Multiplatform version [1.6.10-rc01](https://github.com/JetBrains/compose-multiplatform/releases/tag/v1.6.10-rc01) ?

eymar commented 1 month ago

Since you mentioned that you managed to make K/Wasm target work (here: https://github.com/JetBrains/compose-multiplatform/issues/4811), I close this issue.