Binary incompatability in material3 causes crash
I'm using material3 with the version provided via the compose compiler using kotlin 2.0.0 and the compose plugin 1.7.0-alpha02, and when attempting to show a BottomSheetOverlay I get the following error:
FATAL EXCEPTION: main
java.lang.NoSuchMethodError: No static method rememberModalBottomSheetState(ZLkotlin/jvm/functions/Function1;Landroidx/compose/runtime/Composer;II)Landroidx/compose/material3/SheetState; in class Landroidx/compose/material3/ModalBottomSheet_androidKt; or its super classes (declaration of 'androidx.compose.material3.ModalBottomSheet_androidKt' appears in /data/app/xxxxxx/base.apk)
at com.slack.circuitx.overlays.BottomSheetOverlay.Content(BottomSheetOverlay.kt:116)
at com.slack.circuit.overlay.ComposableSingletons$ContentWithOverlaysKt$lambda-1$1.invoke(ContentWithOverlays.kt:62)
at com.slack.circuit.overlay.ComposableSingletons$ContentWithOverlaysKt$lambda-1$1.invoke(ContentWithOverlays.kt:58)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:139)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.animation.AnimatedContentKt$AnimatedContent$6$1$5.invoke(AnimatedContent.kt:803)
at androidx.compose.animation.AnimatedContentKt$AnimatedContent$6$1$5.invoke(AnimatedContent.kt:792)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:118)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.animation.AnimatedVisibilityKt.AnimatedEnterExitImpl(AnimatedVisibility.kt:771)
at androidx.compose.animation.AnimatedContentKt$AnimatedContent$6$1.invoke(AnimatedContent.kt:774)
at androidx.compose.animation.AnimatedContentKt$AnimatedContent$6$1.invoke(AnimatedContent.kt:757)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.animation.AnimatedContentKt.AnimatedContent(AnimatedContent.kt:816)
at androidx.compose.animation.AnimatedContentKt.AnimatedContent(AnimatedContent.kt:143)
at com.slack.circuit.overlay.ContentWithOverlaysKt$ContentWithOverlays$1.invoke(ContentWithOverlays.kt:45)
at com.slack.circuit.overlay.ContentWithOverlaysKt$ContentWithOverlays$1.invoke(ContentWithOverlays.kt:42)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:380)
at com.slack.circuit.overlay.ContentWithOverlaysKt.ContentWithOverlays(ContentWithOverlays.kt:39)
at com.slack.circuit.overlay.ContentWithOverlaysKt.ContentWithOverlays$lambda$5(Unknown Source:16)
at com.slack.circuit.overlay.ContentWithOverlaysKt.$r8$lambda$fzZPeowOhrqlxzNZGJ6IlzP4rC8(Unknown Source:0)
at com.slack.circuit.overlay.ContentWithOverlaysKt$$ExternalSyntheticLambda1.invoke(D8$$SyntheticClass:0)
at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:192)
at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2823)
at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:3114)
at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3605)
at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:3550)
at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:948)
at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:1198)
at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:132)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:609)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:578)
at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:41)
E at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109)
at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41)
at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1337)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1348)
at android.view.Choreographer.doCallbacks(Choreographer.java:952)
at android.view.Choreographer.doFrame(Choreographer.java:878)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1322)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8177)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.runtime.PausableMonotonicFrameClock@320a7cc, androidx.compose.ui.platform.MotionDurationScaleImpl@bcfca15, StandaloneCoroutine{Cancelling}@849a12a, AndroidUiDispatcher@6f09b1b]
It seems to be an issue with the material3 bottomsheet change made in 1.3.0-beta01, which broke binary compatability, and moved the method in question from ModalBottomSheet_androidKt to the ModalBottomSheetKt - see https://github.com/androidx/androidx/commit/6e8cb3eac945ad2f446d5bd142593b18c52ae8c2
I've been unable to force Circuit to use the same versions as my app, and it seems to be because the library gets bundled into Circuit, where I cannot touch it. For now I've had to resort to copy the circuitx-overlays into my own project, make it use the same versions and then it works.
Any chance you can bump the version in Circuit? :)
Thanks a lot!
We're going to look into cutting 1.7.x releases based on compose 1.7 alphas. This is an unfortunate side effect of their long alpha cycles despite the existence of experimental annotations :/
Alright :) Thanks for the quick reply!
Fixed on main now and will be available in the next release