To enable desugaring in our android-library module we must put this in build.gradle
:
android {
compileOptions {
coreLibraryDesugaringEnabled true
}
}
But we have all scripts migrated to gradle kotlin dsl, so the problem occurs in build.gradle.kts
in all three ways:
android {
compileOptions {
isCoreLibraryDesugaringEnabled = true
}
}
configure<BaseExtension> {
compileOptions {
isCoreLibraryDesugaringEnabled = true
}
}
android {
if (this is com.android.build.api.dsl.LibraryExtension<*, *, *, *, *, *, *, *, *, *, *>) {
buildFeatures.viewBinding = true
}
}
Every time it throws
Unresolved reference: isCoreLibraryDesugaringEnabled
Does anybody have an idea how to fix this?
It wasn't working because of a missing line in the top-level build.gradle.kts
. This line:
classpath("com.android.tools.build:gradle:4.0.1")