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.86k stars 1.15k forks source link

LazyVerticalStaggeredGrid usage breaks Compose MPP builds on 1.4.0 (Web Canvas & iOS) #3144

Open mdigman opened 1 year ago

mdigman commented 1 year ago

Describe the bug Using LazyVerticalStaggeredGrid in a web canvas projects breaks project builds because of dependency conflicts

Affected platforms Select one of the platforms below:

Versions

To Reproduce Add this Composable to a project and attempt to build:

 @OptIn(ExperimentalFoundationApi::class)
 @Composable fun LazyBuildFailureTest() {
     LazyVerticalStaggeredGrid(StaggeredGridCells.Adaptive(100.dp)) {
         item {
             Box(Modifier.background(color = Color.Blue).size(100.dp))
         }
     }
 }

You should see the appx following build error:

e: Module "org.jetbrains.compose.foundation:foundation" has a reference to symbol [ File '/mnt/agent/work/172e546b22c60d2b/compose/frameworks/support/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridMeasureResult.kt' <- androidx.compose.foundation.lazy.staggeredgrid/LazyStaggeredGridPositionedItem|null[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. "org.jetbrains.compose.animation:animation" (a library with unknown version)
 3. "org.jetbrains.compose.animation:animation-core" (a library with unknown version)
 4. "org.jetbrains.compose.foundation:foundation-layout" (a library with unknown version)
 5. "org.jetbrains.compose.runtime:runtime" (a library with unknown version)
 6. "org.jetbrains.compose.runtime:runtime-saveable" (a library with unknown version)
 7. "org.jetbrains.compose.ui:ui" (a library with unknown version)
 8. "org.jetbrains.compose.ui:ui-geometry" (a library with unknown version)
 9. "org.jetbrains.compose.ui:ui-graphics" (a library with unknown version)
10. "org.jetbrains.compose.ui:ui-text" (a library with unknown version)
11. "org.jetbrains.compose.ui:ui-unit" (a library with unknown version)
12. "org.jetbrains.compose.ui:ui-util" (a library with unknown version)
13. "org.jetbrains.skiko:skiko" (a library with unknown version)
14. "org.jetbrains.kotlin:kotlinx-atomicfu-runtime" (a library with unknown version)
15. "org.jetbrains.kotlinx:atomicfu" (a library with unknown version)
16. "org.jetbrains.kotlinx:kotlinx-coroutines-core" (a library with unknown version)

Expected behavior The build succeeds and LazyVerticalStaggeredGrid runs normally as it does on Android and Desktop builds.

zacharee commented 1 year ago

This also happens with the iOS target and Kotlin 1.8.10.

kotlin.native.cacheKind=none is set.

mdigman commented 1 year ago

Confirmed today that this issue still exists on Compose MPP 1.4.1 with the same Kotlin target

okushnikov commented 1 month ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.