gpt4 book ai didi

android - 撰写崩溃并出现错误 "kotlinx.coroutines.channels.Channel"

转载 作者:行者123 更新时间:2023-12-05 05:59:19 26 4
gpt4 key购买 nike

Compose 应用崩溃并出错:

java.lang.NoSuchMethodError: No interface method trySend-JP2dKIU(Ljava/lang/Object;)Ljava/lang/Object; in class Lkotlinx/coroutines/channels/Channel; or its super classes (declaration of 'kotlinx.coroutines.channels.Channel' appears in /data/app/~~x0AHNhyBSh0nzc6B-ZQp6g==/com.test.app-h8KTWE9gDnxiOcVLPrnmkA==/base.apk!classes28.dex)
at androidx.compose.ui.platform.GlobalSnapshotManager$ensureStarted$2.invoke(GlobalSnapshotManager.android.kt:50)
at androidx.compose.ui.platform.GlobalSnapshotManager$ensureStarted$2.invoke(GlobalSnapshotManager.android.kt:49)
at androidx.compose.runtime.snapshots.SnapshotKt.notifyWrite(Snapshot.kt:1651)
at androidx.compose.runtime.SnapshotMutableStateImpl.setValue(SnapshotState.kt:916)
at androidx.compose.ui.platform.AndroidComposeView.setViewTreeOwners(AndroidComposeView.android.kt:1260)
at androidx.compose.ui.platform.AndroidComposeView.onAttachedToWindow(AndroidComposeView.android.kt:813)
at android.view.View.dispatchAttachedToWindow(View.java:20483)

我的应用程序 gradle 文件:

dependencies {
implementation(project(":mpp-library"))

implementation("androidx.core:core-ktx:1.5.0")
implementation("com.google.android.material:material:1.3.0")
implementation("androidx.appcompat:appcompat:1.3.0")
implementation("androidx.constraintlayout:constraintlayout:2.0.4")

implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0")

val compose_version = "1.0.0-rc01"
implementation("androidx.compose.ui:ui:${compose_version}")
implementation("androidx.compose.foundation:foundation:${compose_version}")
implementation("androidx.compose.material:material:${compose_version}")
implementation("androidx.compose.material:material-icons-core:${compose_version}")
implementation("androidx.compose.material:material-icons-extended:${compose_version}")
implementation("androidx.compose.ui:ui-tooling:$compose_version")
}

android {
compileSdkVersion(30)
defaultConfig {
applicationId = "com.test.myapp"
minSdkVersion(21)
targetSdkVersion(30)
versionCode = 1
versionName = "1.0"
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}

packagingOptions {
exclude("META-INF/*.kotlin_module")
}

composeOptions {
kotlinCompilerExtensionVersion = compose_version
}

kotlinOptions {
jvmTarget = "1.8"
}

buildFeatures {
compose = true
dataBinding = true
viewBinding = true
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}

最佳答案

我遇到了同样的问题。我通过更新 Kotlin Coroutines 修复了它。因为 'kotlinx.coroutines.channels.Channel' 是 Kotlin Coroutines 中的一个类。

implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0")

关于android - 撰写崩溃并出现错误 "kotlinx.coroutines.channels.Channel",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68220350/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com