Jetpack编写预览渲染java.lang.ClassNotFoundException:android.os.ext.sdkExtensions错误

nbewdwxp  于 2023-04-10  发布在  Android
关注(0)|答案(1)|浏览(120)

我在git上推送之前可以使用compose preview,但是在我推送它并从其他程序员那里更新项目之后,我就不能再使用它了。我该如何解决这个错误?

java.lang.NoClassDefFoundError: android/os/ext/SdkExtensions   
at androidx.core.os.BuildCompat$Extensions30Impl.<clinit>(BuildCompat.java:302)   
at androidx.core.os.BuildCompat.<clinit>(BuildCompat.java:256)   
at androidx.compose.ui.text.android.BoringLayoutFactory.measure(BoringLayoutFactory.kt:49)   
at androidx.compose.ui.text.android.LayoutIntrinsics.getBoringMetrics(LayoutIntrinsics.kt:55)   
at androidx.compose.ui.text.android.LayoutIntrinsics.getMaxIntrinsicWidth(LayoutIntrinsics.kt:82)   
at androidx.compose.ui.text.platform.AndroidParagraphIntrinsics.getMaxIntrinsicWidth(AndroidParagraphIntrinsics.android.kt:64)   
at androidx.compose.ui.text.MultiParagraphIntrinsics$maxIntrinsicWidth$2.invoke(MultiParagraphIntrinsics.kt:82)   
at androidx.compose.ui.text.MultiParagraphIntrinsics$maxIntrinsicWidth$2.invoke(MultiParagraphIntrinsics.kt:80)   
at _layoutlib_._internal_.kotlin.UnsafeLazyImpl.getValue(Lazy.kt:81)   
at androidx.compose.ui.text.MultiParagraphIntrinsics.getMaxIntrinsicWidth(MultiParagraphIntrinsics.kt:80)   
at androidx.compose.foundation.text.TextDelegate.getMaxIntrinsicWidth(TextDelegate.kt:121)   
at androidx.compose.foundation.text.TextDelegate.layoutText-K40F9xA(TextDelegate.kt:200)   
at androidx.compose.foundation.text.TextDelegate.layout-NN6Ew-U(TextDelegate.kt:248)   
at androidx.compose.foundation.text.TextController$measurePolicy$1.measure-3p2s80s(CoreText.kt:306)   
at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:106)   
at androidx.compose.ui.graphics.SimpleGraphicsLayerModifier.measure-3p2s80s(GraphicsLayerModifier.kt:649)  
......
a64a0gku

a64a0gku1#

我在将androidx.core:core-ktx库从1.9.0更新到1.10.0后遇到了同样的问题。恢复到1.9.0后,预览再次呈现。
查看1.10.0的发行说明,对SdkExtensions(Pull request)进行了更新。

相关问题