Reputation: 418
let me ask
I use kotlin coroutine
@OptIn(DelicateCoroutinesApi::class)
GlobalScope.launch {
displaySura()
}
and in the build tab showing warning:
This annotation should be used with the compiler argument '-opt-in=kotlin.RequiresOptIn'
how to solve this warning? thanks in advance
Upvotes: 10
Views: 4158
Reputation: 6967
To clarify to @Sergio's answer, you can add the block here in your app's build.gradle file
android {
kotlinOptions {
jvmTarget = '1.8'
freeCompilerArgs += [
"-Xopt-in=kotlin.RequiresOptIn"
]
}
Upvotes: 7
Reputation: 30745
You can add -opt-in=kotlin.RequiresOptIn
compiler argument in the build file:
compileKotlin {
kotlinOptions {
freeCompilerArgs += [
"-Xopt-in=kotlin.RequiresOptIn"
]
}
}
Upvotes: 17