How to apply free compile args in Kotlin Multiplatform?

To apply free compile args in Android I used below line (Gradle Kotlin DSL).
freeCompilerArgs = freeCompilerArgs + "-Xallow-result-return-type" + "-Xinline-classes"

How to apply it for KMP? I’m using Android Studio.

1 Like
tasks.withType<KotlinCompileCommon>().configureEach {
    kotlinOptions {
        freeCompilerArgs = freeCompilerArgs + "-Xallow-result-return-type" + "-Xinline-classes"
    }
}
1 Like

Didn’t work for me. I had to use the following (Kotlin 1.7.10):

sourceSets {
    all {
        languageSettings.optIn("org.mylibrary.OptInAnnotation")
    }
}
1 Like