I use build.gradle.kts to build my android project. The following code does NOT compile:
configurations.all { conf: Configuration ->
println(conf)
}
error is:
println(conf)
^ Type mismatch: inferred type is Unit but Boolean was expected
But if you remove the conf:Configuration ->
declaration, it compiled:
configurations.all {
println(conf)
}
I know that the first one matches Iteralbe.all
which need a boolean return value, while the second matches DomainObjectCollection.all
. But why?
Thanks if any answer