小编Kar*_*ouh的帖子

Jetpack compose 更新到 1.0.0-rc01 后无法预览

仅当我更新到 1.0.0-rc01 时才发生这种情况。它说:

找不到以下类:- androidx.compose.ui.tooling.preview.ComposeViewAdapter(修复构建路径、编辑 XML、创建类)

在此处输入图片说明

我的代码:

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

android android-jetpack-compose

55
推荐指数
4
解决办法
4866
查看次数

如何使用 Hilt (Jetpack Compose) 将 ViewModel 注入到可组合函数中

我正在做与此处的文档中所示相同的操作。我想将 ViewModel 注入可组合函数(屏幕),但出现此错误:

无法创建类 com.example.blotube.ui.later.LaterViewModel 的实例

我的视图模型:

@HiltViewModel
class LaterViewModel @Inject constructor(
    private val database: Database
):ViewModel() {

    val watchLater=database.videos().getAll()

}
Run Code Online (Sandbox Code Playgroud)

我的可组合函数(屏幕):

@Composable
fun WatchLater(vm: LaterViewModel = viewModel()){


    val videos=vm.watchLater.observeAsState()
    val context= LocalContext.current
    

}
Run Code Online (Sandbox Code Playgroud)

mvvm viewmodel android-jetpack-compose dagger-hilt

6
推荐指数
4
解决办法
1709
查看次数

添加 Meta Audience Network 后出现“重复类”错误 - Android

每当我在添加元依赖项后尝试构建我的应用程序时,都会收到此错误消息:在模块 core-1.9.0-runtime (androidx.core:core:1.9.0) 中找到重复的类 android.support.v4.app.INotificationSideChannel 和support-compat-25.2.0-runtime (com.android.support:support-compat:25.2.0) 在模块 core-1.9.0-runtime (androidx. core:core:1.9.0) 和 support-compat-25.2.0-runtime (com.android.support:support-compat:25.2.0) 在中找到重复的类 android.support.v4.app.INotificationSideChannel$Stub$Proxy模块 core-1.9.0-runtime (androidx.core:core:1.9.0) 和 support-compat-25.2.0-runtime (com.android.support:support-compat:25.2.0) 重复类 android.support。 v4.os.IResultReceiver 在模块 core-1.9.0-runtime (androidx.core:core:1.9.0) 和 support-compat-25.2.0-runtime (com.android.support:support-compat:25.2.0) 中找到)在模块 core-1.9.0-runtime (androidx.core:core:1.9.0) 和 support-compat-25.2.0-runtime (com.android. support:support-compat:25.2.0) 在模块 core-1.9.0-runtime (androidx.core:core:1.9.0) 和 support-compat 中找到重复的类 android.support.v4.os.IResultReceiver$Stub$Proxy -25.2.0-runtime (com.android.support:support-compat:25.2.0) 在模块 core-1.9.0-runtime (androidx.core:core:1.9) 中找到重复的类 android.support.v4.os.ResultReceiver .0) 和 support-compat-25.2.0-runtime (com.android.support:support-compat:25.2.0) 在 core-1.9.0-runtime 模块中找到重复的类 android.support.v4.os.ResultReceiver$1 (androidx.core:core:1.9.0) 和 support-compat-25.2.0-runtime (com.android.support:support-compat:25.2.0) 找到重复的类 android.support.v4.os.ResultReceiver$MyResultReceiver在模块 core-1.9.0-runtime (androidx.core:core:1.9.0) 和 support-compat-25.2.0-runtime (com.android.support:support-compat:25.2.0) 中重复类 android.support .v4.os.ResultReceiver$MyRunnable 在模块 core-1.9.0-runtime (androidx.core:core:1.9.0) 和 support-compat-25.2.0-runtime (com.android.support:support-compat: 25.2.0) …

dependencies android facebook ads android-studio

1
推荐指数
1
解决办法
2155
查看次数

通过文档 ID 数组从 firebase 获取文档 (Kotlin)

有没有办法通过 ID 列表从 firebase 获取文档?我有这个列表: val IDs= listOf("id1","id2","id3","id4") 我想获取所有这些文档而不循环遍历它们。如果可能的话,像这样: Firebase.firestore.collection("users").documents(IDs).get()

android document kotlin firebase google-cloud-firestore

0
推荐指数
1
解决办法
1180
查看次数