We're running into some issues using compose libra...
# compose
d
We're running into some issues using compose libraries with a compose-enabled app. If the app version of compose and the library version of compose don't match we'll randomly run into what seem to be binary incompatibilities that cause runtime exceptions in the primary app when viewing library UI components (often with NoSuchMethodError). This creates complications where the version of Compose we use (or is used in our libraries) determines what Kotlin version we can use (which might be impossible with multiple compose-using libraries). I haven't seen any references to this problem so I can only imagine we have something misconfigured? Is there something special we can do with our gradle configuration in our library and or application to address this issue? Or have other people found that Compose introduces this logistical versioning nightmare to their projects? tl;dr: is Compose supposed to be binary compatible? Because we get NoSuchMethodErrors when the library and app versions of compose don't match.
i
Stable APIs are guaranteed to be binary compatible. Experimental APIs are not. That's precisely the reason those are two separate things
If the library you are using is using experimental APIs, you'll need to wait for all of those libraries to release a version based on a new version of Compose before you can adopt it yourself
d
So any experimental APIs in the library break binary compatibility?
i
They may change at any time in binary incompatible ways, yes. That is what Experimental means
d
Sure, it just seems like it's breaking in places that aren't involved with the experimental APIs.
Thanks for answering though, this clarifies the issue.
i
There's some additional information in this blog post: https://link.medium.com/Szcpub2n2zb
You'd have to share what specific NoSuchMethodErrors you are getting if you want anything more specific
d
Our code is calling constrainAs { start.linkTo(parent.start) } 05-23 091531.765 24856 24856 E AndroidRuntime: java.lang.NoSuchMethodError: No virtual method getStart()Landroidx/constraintlayout/compose/ConstrainScope$VerticalAnchorable; in class Landroidx/constraintlayout/compose/ConstrainScope; or its super classes (declaration of ‘androidx.constraintlayout.compose.ConstrainScope’ appears in /base.apk!classes22.dex) 05-23 091531.765 24856 24856 E AndroidRuntime: at com... 05-23 091531.765 24856 24856 E AndroidRuntime: at com... 05-23 091531.765 24856 24856 E AndroidRuntime: at androidx.constraintlayout.compose.ConstraintSetForInlineDsl$applyTo$1.invoke(ConstraintLayout.kt:160) 05-23 091531.765 24856 24856 E AndroidRuntime: at androidx.constraintlayout.compose.ConstraintSetForInlineDsl$applyTo$1.invoke(ConstraintLayout.kt:154) 05-23 091531.765 24856 24856 E AndroidRuntime: at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2139) 05-23 091531.765 24856 24856 E AndroidRuntime: at androidx.compose.runtime.snapshots.SnapshotStateObserver$observeReads$1$1.invoke(SnapshotStateObserver.kt:130) 05-23 091531.765 24856 24856 E AndroidRuntime: at androidx.compose.runtime.snapshots.SnapshotStateObserver$observeReads$1$1.invoke(SnapshotStateObserver.kt:126) 05-23 091531.765 24856 24856 E AndroidRuntime: at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:341) 05-23 091531.765 24856 24856 E AndroidRuntime: at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source:1) 05-23 091531.765 24856 24856 E AndroidRuntime: at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:126) 05-23 091531.765 24856 24856 E AndroidRuntime: at androidx.constraintlayout.compose.ConstraintSetForInlineDsl.applyTo(ConstraintLayout.kt:154) 05-23 091531.765 24856 24856 E AndroidRuntime: at androidx.constraintlayout.compose.Measurer.performMeasure-DjhGOtQ(ConstraintLayout.kt:1219) 05-23 091531.765 24856 24856 E AndroidRuntime: at androidx.constraintlayout.compose.ConstraintLayoutKt$rememberConstraintLayoutMeasurePolicy$1$measurePolicy$1.measure-3p2s80s(ConstraintLayout.kt:110) 05-23 091531.765 24856 24856 E AndroidRuntime: at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:103) Here's a snippet in case it's helpful. We're using Compose 1.3.2/1.3.1
Unsure if this would be enough stack trace though.
Ohhhh, we also use accompanist, which might be at fault
Anyway thanks for the answer, this was extremely helpful!
a
accompanist is causing the crash -> https://github.com/google/accompanist/issues/1636