Within my Android application project I am using the following Gradle (Groovy) configuration for a library module:
// build.gradle
apply plugin: "java-library"
apply plugin: "kotlin"
dependencies {
api Libs.engelsystem
implementation(Libs.retrofit) {
exclude group: "com.squareup.okio", module: "okio"
}
testImplementation Libs.junit
testImplementation Libs.kotlinCoroutinesTest
testImplementation Libs.mockitoKotlin
testImplementation Libs.okhttpMockWebServer
testImplementation Libs.retrofitConverterMoshi
testImplementation Libs.truth
}
sourceCompatibility = Config.compatibleJavaVersion
targetCompatibility = Config.compatibleJavaVersion
compileKotlin {
kotlinOptions {
jvmTarget = Config.compatibleJavaVersion // is set to JavaVersion.VERSION_11
freeCompilerArgs += [
"-opt-in=kotlin.RequiresOptIn"
]
}
}
Android Studio Giraffe / Lint notifies me that kotlinOptions is deprecated.
There is no quick fix to apply. How can I replace the notation correctly? It seems there is a different syntax for this kind of library module. There is no deprecation warning in a com.android.library module nor in a com.android.application module. Both use the kotlin-android plugin if that is an important difference.
Potential answer
... consider them as non-officially deprecated ...

Compile tasks have the new
compilerOptionsinput, which is similar to the existingkotlinOptionsbut uses Property from theGradleProperties API as the return type.Here is your updated code:
References: