I'm using compose version compose-bom 2023.03.00 and when I try to add the latest compose animation module (1.7.0-alpha07) with shared elements update, the app crashes on launch with error showing
java.lang.NoSuchMethodError: No static method restrictedConstraints-xF2OJ5Q$default(Landroidx/compose/ui/unit/Constraints$Companion;IIIIZILjava/lang/Object;)J in class Landroidx/compose/ui/unit/Constraints$Companion; or its super classes (declaration of 'androidx.compose.ui.unit.Constraints$Companion' appears in /data/app/com.xx.xxxx-55o2y0IBA6N3Qr0mj4DgbQ==/base.apk
at androidx.compose.foundation.layout.RowColumnMeasurementHelper.measureWithoutPlacing-EkL-Y(RowColumnMeasurementHelper.kt:187) at androidx.compose.foundation.layout.RowColumnMeasurePolicy.measure-3p2s80s(RowColumnImpl.kt:69) at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:135) at androidx.compose.foundation.layout.SizeNode.measure-3p2s80s(Size.kt:838)
Just adding the dependency itself causes the crash (without adding any ShareElementsLayout etc).
IN a sample app, it works fine. Is it due to any compatibility issues with other compose libraries ? How can I find the issue due to incompatibility issues ?
I tried matching the sample app's dependency versions (1.7.0-beta01 also has issues), but there are other libraries also found in our main app.
It also created the same crash.
Adding the dependency implementation("androidx.compose.material:material:1.7.0-beta01") along with the compose-animation 1.7.0 beta01, which seems to make the project run without any issues.
I'm still not sure about this particular dependency. I've tried to add the material:material library in the bom.
But the project by philip lackner - https://github.com/philipplackner/SharedElementTransitionCompose/blob/master/gradle/libs.versions.toml
uses a combination of stable bom with compose animation alpha, which seems to be working fine. Maybe there is some extra dependencies in my project which contributes this issue.