我正在使用 Material 3 库的 ModalBottomSheet,当我想在 OutlinedTextField 中输入内容时,我注意到一个奇怪的行为。这是一个我无法操纵的奇怪问题。
Column(
modifier = Modifier.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Row(
Modifier.toggleable(
value = skipHalfExpanded,
role = Role.Checkbox,
onValueChange = { checked -> skipHalfExpanded = checked }
)
) {
Checkbox(checked = skipHalfExpanded, onCheckedChange = null)
Spacer(Modifier.width(16.dp))
Text("Skip Half Expanded State")
}
Button(onClick = { openBottomSheet = !openBottomSheet }) {
Text(text = "Show Bottom Sheet")
}
}
// Sheet content
if (openBottomSheet) {
ModalBottomSheet(
onDismissRequest = { openBottomSheet = false }, …Run Code Online (Sandbox Code Playgroud) 当尝试将用 kotlin 编写的现有简单 Android 应用程序转换为KMM时,我遇到了阻止程序。
下面是以下错误。
Please initialize at least one Kotlin target in 'kmmsharedmodule (:kmmsharedmodule)'.
Read more https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#setting-up-targets
Unresolved reference: iosSimulatorArm64
Run Code Online (Sandbox Code Playgroud)
我阅读了链接中提供的文档,但似乎不是我想要的直接解决方案。
我采取的过程只是通过 android studio 中提供的支持添加 KMM 模块。
我寻找过其他来源,但找不到任何相关问题
每次添加 firebase 依赖项,运行我的应用程序并将套接字连接到端点时,我的应用程序立即崩溃。
我同时使用 firebase 和 socket.io,由于兼容性问题导致崩溃。firebase 和 socket.io 可以一起使用吗?
当我添加 firebase 并尝试在我的项目中连接到 socket.io 时出现以下错误
E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
Process: com.project.hubrydemanagerapp, PID: 30101
java.lang.NoSuchMethodError: No virtual method callEngineGetConnection(Lcom/squareup/okhttp/Call;)Lcom/squareup/okhttp/Connection; in class Lcom/squareup/okhttp/internal/Internal; or its super classes (declaration of 'com.squareup.okhttp.internal.Internal' appears in /data/app/com.project.hubrydemanagerapp-t3ZbPD-QZAE9y2BMT64Cdg==/base.apk!classes3.dex)
at com.squareup.okhttp.ws.WebSocketCall.createWebSocket(WebSocketCall.java:154)
at com.squareup.okhttp.ws.WebSocketCall.access$000(WebSocketCall.java:42)
at com.squareup.okhttp.ws.WebSocketCall$1.onResponse(WebSocketCall.java:102)
at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:177)
at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Run Code Online (Sandbox Code Playgroud)
我的依赖:
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.google.firebase:firebase-firestore:21.3.0'
implementation 'com.squareup.okhttp3:okhttp:4.2.2'
implementation('com.github.nkzawa:socket.io-client:0.6.0') {
exclude group: 'org.json', module: 'json'
}
Run Code Online (Sandbox Code Playgroud)
端点
"https://hubryde-trip-service.herokuapp.com/";
"https://hubryde-request-service.herokuapp.com/";
Run Code Online (Sandbox Code Playgroud)
联系。我正在使用 Application 类来创建套接字模型。
tripSocket …Run Code Online (Sandbox Code Playgroud)