让我问一下
我用kotlin coroutine
@OptIn(DelicateCoroutinesApi::class)
GlobalScope.launch {
displaySura()
}
在显示警告的build选项卡中:
This annotation should be used with the compiler argument '-opt-in=kotlin.RequiresOptIn'
如何解决这个警告?提前感谢
发布于 2022-04-21 08:58:56
可以在构建文件中添加-opt-in=kotlin.RequiresOptIn
编译器参数:
compileKotlin {
kotlinOptions {
freeCompilerArgs += [
"-Xopt-in=kotlin.RequiresOptIn"
]
}
}
发布于 2022-10-16 18:34:44
为了澄清@Sergio的答案,您可以在应用程序的build.gradle文件中添加这个块
android {
kotlinOptions {
jvmTarget = '1.8'
freeCompilerArgs += [
"-Xopt-in=kotlin.RequiresOptIn"
]
}
https://stackoverflow.com/questions/71951505
复制相似问题