Jetpack compose can't preview after updating to 1.0.0-rc01


只有当我更新为1.0.0-rc01时,这才发生在我身上。 它说:

The following classes could not be found: - androidx.compose.ui.tooling.preview.ComposeViewAdapter (Fix Build Path, Edit XML, Create Class)

我的代码:


@Composable
@Preview
fun CenterProgress(){
    Box(
        modifier= Modifier.fillMaxSize(),
        contentAlignment = Alignment.Center
    ){
        CircularProgressIndicator(strokeWidth = 3.dp)
    }
}
  

更新07/20/2021: 只需下载并使用最新来解决问题


他们在RC01中分配了一些软件包,但PER @Commonsware评论(所有信用归功于他),似乎Android Studio版本本身存在问题。 您有2个选项:

  1. Downgrade to beta09 until AS ArcticFox RC1 is out
  2. Try the suggested workaround, use AS Arctic Fox Beta 5 leaving all compose dependencies to 1.0.0-rc01 version and downgrade only ui-tooling to 1.0.0-beta09 (confirmed by comments).

额外的详细信息

在这里,您可以找到他们搬进的所有课程1.0.0-rc01https://android-review.googlesource.com/c/platform/frameworks/support/+/1739498以及关于为什么确定此问题的说明。

简而言之,您现在可以为某些特定的优化方案执行此操作(这不应该是默认情况):


debugImplementation "androidx.compose.ui:ui-tooling:1.0.0-rc01"
implementation "androidx.compose.ui:ui-tooling-preview:1.0.0-rc01"
  

Jetpack compose can't preview after updating to 1.0.0-rc01的相关文章

随机推荐