I'm trying to use the @ExperimentalUnsignedTypes
in my AndroidStudio project. It seems I have to put that just about everywhere, so I'd rather set it once project wide.
The documentation says
Usages of such API will be reported as warnings unless an explicit opt-in with the UseExperimental annotation, e.g. @UseExperimental(ExperimentalUnsignedTypes::class), or with the -Xuse-experimental=kotlin.ExperimentalUnsignedTypes compiler option is given.
Dutifully, I have adjusted my Preferences>>Other Settings>>Kotlin Compiler
:
But I still get (lots of) warnings after a clean/make. It was suggested that I also add -XXLanguage:+InlineClasses
to the same line. But the result is the same. Then I noticed at the top of same preferences pane it says:
Is this my problem? And if so, where can I adjust my app settings so that these compiler settings are effective?
Even with the spelling correction fixed, it still did not compile correctly. I suspect the "...override project settings..." indeed was problematic. However, placing the following in my (project) gradle file did work:
android {
…
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
// Disable warnings when using unsigned types
freeCompilerArgs += "-Xopt-in=kotlin.ExperimentalUnsignedTypes"
}
}
}