我刚刚将撰写版本更新为1.0.0-beta07,它显示了这个运行时错误。
No interface method startRestartGroup(ILjava/lang/String;)Landroidx/compose/runtime/Composer; in class Landroidx/compose/runtime/Composer; or its super classes (declaration of 'androidx.compose.runtime.Composer'
....
at com.google.accompanist.coil.CoilImage__CoilKt.CoilImage(Coil.kt:245)
at com.google.accompanist.coil.CoilImage.CoilImage(Coil.kt:1)下面是我的gradle依赖项文件
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation "androidx.compose.compiler:compiler:$compose_version"
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.ui:ui-tooling:$compose_version"
implementation "androidx.compose.runtime:runtime:$compose_version"
implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
implementation 'androidx.activity:activity-compose:1.3.0-alpha08'
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha05"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation "io.coil-kt:coil-gif:1.2.1"
implementation "io.coil-kt:coil-svg:1.2.1"
implementation "com.google.accompanist:accompanist-coil:0.6.2"和版本compose_version = '1.0.0-beta07'
发布于 2021-05-24 05:41:35
每个库都需要根据beta07重新编译才能工作,就像按照撰写发行说明那样
注意:依赖于撰写的库将需要用1.0.0-beta07版本重新编译。否则,库可能遇到
NoSuchMethodError,例如:java.lang.NoSuchMethodError: No interface method startReplaceableGroup(ILjava/lang/String;)V in class Landroidx/compose/runtime/Composer; or its super classes. (Ia34e6)
在您的例子中,您必须用0.10.0更新伴奏库。
更改:
implementation "com.google.accompanist:accompanist-coil:0.6.2"至
implementation "com.google.accompanist:accompanist-coil:0.10.0"发布于 2021-08-18 17:23:20
线圈,幻灯片和图像加载核心已被删除后,在v0.14.0,是时候删除线圈,滑动和图像-核心库。关于这一点的一些讨论可以在Kotlin:https://kotlinlang.slack.com/archives/CJLTWPH7S/p1627482619344000上看到。建议移到https://coil-kt.github.io/coil/compose/
因此,改变;
implementation "com.google.accompanist:accompanist-coil:0.6.2"至
implementation("io.coil-kt:coil-compose:1.3.2")另外,CoilImage也被删除了,您可以使用;
Image(
painter = rememberImagePainter("https://www.example.com/image.jpg"),
contentDescription = null,
modifier = Modifier.size(128.dp)
)发布于 2021-05-25 23:37:16
确保您的所有组合库都使用相同版本的1.0.0-beta07。这应该能解决你的问题。
https://stackoverflow.com/questions/67667099
复制相似问题