Closed tasjapr closed 1 year ago
This looks like a version conflict with the foundation
and ui
Compose artifacts. I'd ensure that both androidx.compose.foundation:foundation
and androidx.compose.ui:ui
are both at version 1.4.0.
I have big issue with coil
2.3.0 / 2.4.0
. Currently I use version2.2.2
and everything is fine, but when I trying to updatecoil
version i get crash in runtime. In the stacktrace i see references to my customModalBottomSheetLayout
function. But there is no coil images in this function, anycoil
imports in this file. Maybe this happens because ofModalBottomSheetLayout
from m2 and not m3?Output:
FATAL EXCEPTION: main Process: com.[...], PID: 12083 java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/compose/ui/input/ScrollContainerInfo; at androidx.compose.material.ModalBottomSheetKt.ModalBottomSheetLayout-BzaUkTc(ModalBottomSheet.kt:328) at com.[...].SingleButtonPopup-EVJuX4I(SingleButtonPopup.kt:36) at com.[...].KYCPopup(KYCPopup.kt:21) at com.[...](....kt:237) at com.[...].MainActivity$onCreate$1$2.invoke(MainActivity.kt:70) at com.[...].MainActivity$onCreate$1$2.invoke(MainActivity.kt:65) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34) at [...].designsystem.theme.AppThemeKt$AppTheme$1.invoke(AppTheme.kt:45) at [...].designsystem.theme.AppThemeKt$AppTheme$1.invoke(AppTheme.kt:44) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34) at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228) at [...].designsystem.theme.AppThemeKt.AppTheme(AppTheme.kt:39) at [...].MainActivity$onCreate$1.invoke(MainActivity.kt:65) at [...].MainActivity$onCreate$1.invoke(MainActivity.kt:50) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34) at androidx.compose.ui.platform.ComposeView.Content(ComposeView.android.kt:428) at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:252) at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:251) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34) at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228) at androidx.compose.ui.platform.CompositionLocalsKt.ProvideCommonCompositionLocals(CompositionLocals.kt:194) at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:123) at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:122) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34) at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228) at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt.ProvideAndroidCompositionLocals(AndroidCompositionLocals.android.kt:114) at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$2.invoke(Wrapper.android.kt:156) at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$2.invoke(Wrapper.android.kt:155) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34) at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228) at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:155) at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:140) 11:32:42.818 E at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34) at androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable(ActualJvm.jvm.kt:78) at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3373) at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3363) at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:341) at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source:1) at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3363) at androidx.compose.runtime.ComposerImpl.composeContent$runtime_release(Composer.kt:3298) at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:587) at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:966) at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:519) at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:140) at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:131) at androidx.compose.ui.platform.AndroidComposeView.setOnViewTreeOwnersAvailable(AndroidComposeView.android.kt:1099) at androidx.compose.ui.platform.WrappedComposition.setContent(Wrapper.android.kt:131) at androidx.compose.ui.platform.WrappedComposition.onStateChanged(Wrapper.android.kt:181) at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.kt:314) at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.kt:192) at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:138) at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:131) at androidx.compose.ui.platform.AndroidComposeView.onAttachedToWindow(AndroidComposeView.android.kt:1174) at android.view.View.dispatchAttachedToWindow(View.java:21290) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3491) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3498) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3498) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3498) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3498) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2820) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2328) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9087) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1231) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1239) at android.view.Choreographer.doCallbacks(Choreographer.java:899) at android.view.Choreographer.doFrame(Choreographer.java:832) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1214) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7872) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.compose.ui.input.ScrollContainerInfo" on path: DexPathList[[zip file "/data/app/~~qFip48BLVL1DCFsxQWKizQ==/com.[...]-kx4CImop_gE0r44ivmjc7w==/base.apk"],nativeLibraryDirectories=[/data/app/~~qFip48BLVL1DCFsxQWKizQ==/com.[...]-kx4CImop_gE0r44ivmjc7w==/lib/x86_64, /data/app/~~qFip48BLVL1DCFsxQWKizQ==/com.[...]-kx4CImop_gE0r44ivmjc7w==/base.apk!/lib/x86_64, /system/lib64, /system_ext/lib64]] 11:32:42.819 E at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) ... 82 more
Here is my
SingleButtonPopup
file:package com.[...] import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.imePadding import androidx.compose.foundation.layout.navigationBars import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material.ModalBottomSheetLayout import androidx.compose.material.ModalBottomSheetState import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import com.[...] import com.[...] import com.[...] @OptIn(ExperimentalMaterialApi::class) @Composable fun SingleButtonPopup( title: String, text: String, buttonText: String, onConfirmClick: () -> Unit, onCloseClick: () -> Unit, buttonColor: Color = AppTheme.colors.primary, textButtonColor: Color = AppTheme.colors.onPrimary, bottomSheetState: ModalBottomSheetState ) { ModalBottomSheetLayout( sheetState = bottomSheetState, sheetShape = AppShapes.large, sheetBackgroundColor = AppTheme.colors.background, sheetContent = { Column( modifier = Modifier .fillMaxWidth() .wrapContentHeight() .windowInsetsPadding(WindowInsets.navigationBars) .imePadding() ) { PopupHeader(title = title, onClose = onCloseClick) Text( text = text, style = AppTheme.typography.s2, color = AppTheme.colors.textPrimary, modifier = Modifier .fillMaxWidth() .padding(top = 8.dp, start = 16.dp, end = 16.dp) ) AppButton( modifier = Modifier .padding(top = 40.dp, start = 16.dp, end = 16.dp, bottom = 30.dp) .height(AppTheme.dimensions.size_56) .fillMaxWidth(), onClick = onConfirmClick, text = buttonText, backgroundColor = buttonColor, contentColor = textButtonColor ) } }, content = {} ) }
AppButton:
@Composable fun AppButton( modifier: Modifier = Modifier, backgroundColor: Color = AppTheme.colors.primary, disabledBackgroundColor: Color = AppTheme.colors.placeholderBackground, isLoading: Boolean = false, enabled: Boolean = true, contentColor: Color = if (enabled) AppTheme.colors.onPrimary else AppTheme.colors.textPrimary.copy(alpha = 0.5f), onClick: () -> Unit, text: String, ) { val multipleEventsCutter = remember { MultipleEventsCutter.get() } Button( onClick = { multipleEventsCutter.processEvent { onClick() } }, shape = AppShapes.medium, colors = ButtonDefaults.buttonColors(backgroundColor = backgroundColor, disabledBackgroundColor = disabledBackgroundColor), enabled = enabled, elevation = null, modifier = modifier ) { if (isLoading) CircularProgressIndicator(color = contentColor) else Text( text = text, style = AppTheme.typography.button, color = contentColor, modifier = Modifier.animateContentSize() ) } }``` `PopupHeader:`
@composable fun PopupHeader( title: String, onClose: () -> Unit, modifier: Modifier = Modifier ) { var isMultilineTitle by remember { mutableStateOf(false) }
Row( horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically, modifier = modifier .padding(top = if (isMultilineTitle) 20.dp else 9.dp, start = 16.dp, end = 4.dp) .fillMaxWidth() ) { Text( text = title, style = AppTheme.typography.h5, color = AppTheme.colors.textPrimary, modifier = Modifier.weight(1f), onTextLayout = { isMultilineTitle = it.lineCount > 1 } ) val multipleEventsCutter = remember { MultipleEventsCutter.get() } IconButton( onClick = { multipleEventsCutter.processEvent { onClose() } }, modifier = Modifier .padding(start = AppTheme.dimensions.padding_4) ) { Icon( // from androidx.compose.material.Icon imageVector = ImageVector.vectorResource(id = R.drawable.ic_close), contentDescription = stringResource(id = R.string.btn_cancel), tint = AppTheme.colors.iconsPrimary ) } }
}
Did you find any solution for this? I'm also getting the same issue!
Okay found the solution! Most likely the material3 version -> 1.2.0-alpha06 has bug I was using dependency without specifying the version number -> implementation("androidx.compose.material3) but as I replaced it with stable version -> implementation("androidx.compose.material3:material3:1.1.1") the error went away.
I have big issue with coil
2.3.0 / 2.4.0
. Currently I use version2.2.2
and everything is fine, but when I trying to updatecoil
version i get crash in runtime. In the stacktrace i see references to my customModalBottomSheetLayout
function. But there is no coil images in this function, anycoil
imports in this file. Maybe this happens because ofModalBottomSheetLayout
from m2 and not m3?Output:
Here is my
SingleButtonPopup
file:AppButton:
@Composable fun PopupHeader( title: String, onClose: () -> Unit, modifier: Modifier = Modifier ) { var isMultilineTitle by remember { mutableStateOf(false) }
}