如何在项目范围内使用 Kotlin ExperimentalUnsignedTypes (AndroidStudio)

How to use Kotlin ExperimentalUnsignedTypes project wide (AndroidStudio)

我正在尝试在我的 AndroidStudio 项目中使用 @ExperimentalUnsignedTypes。看来我必须把它放在几乎所有地方,所以我宁愿在项目范围内设置它。

The documentation

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.

尽职尽责,我调整了我的 Preferences>>Other Settings>>Kotlin Compiler:

但在 clean/make 之后我仍然收到(很多)警告。有人建议我也将 -XXLanguage:+InlineClasses 添加到同一行。但结果是一样的。然后我注意到在同一首选项窗格的顶部它说:

这是我的问题吗?如果是这样,我在哪里可以调整我的应用程序设置以使这些编译器设置生效?

在屏幕截图中你有 -Xexperimental=...,不是必需的 -Xuse-experimental=...

即使修复了拼写更正,它仍然无法正确编译。我怀疑“...覆盖项目设置...”确实有问题。但是,将以下内容放入我的(项目)gradle 文件中确实有效:

allprojects {
    tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
        kotlinOptions {
            freeCompilerArgs += [
                    "-Xuse-experimental=kotlin.ExperimentalUnsignedTypes",
                    "-XXLanguage:+InlineClasses"
            ]
        }
    }
}