如何在 Android Studio 上修复已弃用的协程 Actor,UI

How to fix deprecated coroutines Actor, UI on Android Studio

我是 android 的新手。致力于旧代码库的迁移。我在多个 类 中遇到 actorUI 关键字的错误。有什么解决方案?

dependencies {

        classpath 'com.android.tools.build:gradle:4.1.1'

        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "com.google.gms:google-services:4.3.4"

        classpath("androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version")
    }
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9",
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9"
    private val actor = actor<CelebrationAction>(UI, Channel.CONFLATED) {

        for (action in this) when (action) {
                 
            
            }
        }
    }

private val scope = CoroutineScope(Dispatchers.Default)

private val actor = scope.actor<CelebrationAction>(Dispatchers.Main, Channel.CONFLATED) {
       
        for (action in this) when (action) {
                 
            
            }
        }
    }