Closed firelion9 closed 6 days ago
There are two overloads for layout
on Android, and just a single one in Compose Multiplatform.
Judging from the exception, it seems that some multiplatform artifact is packed into an android app, while during the compilation the correct one is used.
Can you check the dependencies, please?
Unfortunately, I wasn't able to reproduce this issue on the sample project on my machine.
I checked my dependencies, everything looks fine: all compose mutiplatform dependencies are compile-only and androidx.compose.ui:ui-android:1.6.7
is presented in both compile and runtime classpaths of app module. I also checked MeasureScope
definition in android and desktop variants of androidx.compose.ui:ui
and they both contain single layout
overload:
fun layout(
width: Int,
height: Int,
alignmentLines: Map<AlignmentLine, Int> = emptyMap(),
placementBlock: Placeable.PlacementScope.() -> Unit
): MeasureResult { /* ... */ }
Are you sure we are speaking about the same layout
?
Unfortunately, I currently have access to a single windows machine only, but I tried to compile the sample project again from a clean checkout on it with the same result: successful run with android studio's run action and crash when compiling with ./gradlew :app:assembleDebug
or with "generate signed app bundle / apk".
I also inspected generated apks and found out that in crashing apks required method is presented in MeasureScope$-CC
instead of MeasureScope
, but I still don't understand why it happens and why it doesn't happen with android studio's run action
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
Describe the bug Android application crashes after calling multiplatform composable function which itself calls
MeasureScope#layout$default
without passingalignmentLines
parameter. The crash is reproducible when using compose multiplatform 1.6.11 and jetpack compose 1.6.7 (which are said to compatible (docs))Affected platforms
Versions
Libraries:
Kotlin version: 2.0.0
OS versions: Android 14 (both hardware and emulator)
To Reproduce Simple project reproducing the issue (the stacktrace at the end was taken from this app): https://github.com/firelion9/compose-issue
Steps to reproduce the behavior:
Actual behavior App crashes with the following stacktrace:
stacktrace
Expected behavior The activity launches and shows label "Everything is ok".
Additional context The problem is not reproducible without using compose multiplatform (if you move
JbBox
to android module) and when you compile and run application using android studio's "run" action