仅当我更新到 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) 我正在做与此处的文档中所示相同的操作。我想将 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) 每当我在添加元依赖项后尝试构建我的应用程序时,都会收到此错误消息:在模块 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) …
有没有办法通过 ID 列表从 firebase 获取文档?我有这个列表:
val IDs= listOf("id1","id2","id3","id4")
我想获取所有这些文档而不循环遍历它们。如果可能的话,像这样:
Firebase.firestore.collection("users").documents(IDs).get()
android ×3
ads ×1
dagger-hilt ×1
dependencies ×1
document ×1
facebook ×1
firebase ×1
kotlin ×1
mvvm ×1
viewmodel ×1