gpt4 book ai didi

android - 喷气背包撰写 java.lang.IllegalStateException : Start/end imbalance

转载 作者:行者123 更新时间:2023-12-03 21:45:05 25 4
gpt4 key购买 nike

这段代码导致了这个崩溃:
我正在使用撰写版本 1.0.0-alpha06

java.lang.IllegalStateException: Start/end imbalance   at androidx.compose.runtime.Composer.finalizeCompose(Composer.kt:2369)   at androidx.compose.runtime.Composer.endRoot(Composer.kt:575)   at androidx.compose.runtime.Composer.composeInitial(Composer.kt:2054)   at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:276)   at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:110)   at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.kt:234)   at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.kt:-1)   at androidx.compose.ui.platform.AndroidComposeView.onAttachedToWindow(AndroidComposeView.kt:627)   at android.view.View.dispatchAttachedToWindow(View.java:20479)   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3489)   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3496)   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3496)   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3496)   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3496)   at android.view.AttachInfo_Accessor.setAttachInfo(AttachInfo_Accessor.java:44)


有人能帮我吗?谢谢
@Composable
@Preview
private fun Image1() {
Box(modifier = Modifier.fillMaxWidth().wrapContentHeight()) {
Image(
asset = imageResource(id = R.mipmap.fit_static_image_1),
contentScale = ContentScale.FillWidth,
)
Column(Modifier.padding(start = 16.dp, end = 16.dp).align(Alignment.CenterStart), horizontalAlignment = Alignment.Start) {
Text(
color = getColor(id = R.color.white),
fontWeight = FontWeight.Bold,
fontSize = TextUnit.Sp(18),
text = dicString(id = R.string.fit_static_image_1_title),
textAlign = TextAlign.Start
)
Text(
text = dicString(id = R.string.fit_static_image_1_description),
color = getColor(id = R.color.white),
fontSize = TextUnit.Sp(14),
modifier = Modifier.padding(top = 4.dp),
textAlign = TextAlign.Start
)
}
}
}

最佳答案

由于缺乏可组合结构中的数据,我从可组合返回时发生了这种情况。

val dataOrNull by viewModel.data.collectAsState(null)

Box {
MyComposable(
data = dataOrNull ?: return
)
}
我通过在构建树之前返回来解决这个问题
val dataOrNull by viewModel.data.collectAsState(null)

val data = dataOrNull ?: return

Box {
MyComposable(
data = data
)
}

关于android - 喷气背包撰写 java.lang.IllegalStateException : Start/end imbalance,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64893871/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com