El Zhang
05/14/2021, 1:09 PMval appClassicExt = project.extensions.findByType(AppExtension::class.java)!!
appClassicExt.applicationVariants.all { variant -> ... }
2. The issues is the all
function:
• When I wrote it normally, it works perfectly, it calls the right all
function which is org.gradle.api.DomainObjectCollection # void all(Action<? super T> action);
• However when I worked with Kotlin std, it calls this one from Kotlin `_Collections.kt`:
public inline fun <T> Iterable<T>.all(predicate: (T) -> Boolean): Boolean {
if (this is Collection && isEmpty()) return true
for (element in this) if (!predicate(element)) return false
return true
}
So the traversal is not working anymore, may I know how to specifically make it call the one I want (The Gradle API)? Thanks.plastiv
05/14/2021, 1:17 PMandroidComponents {
onVariants { variant ->
plastiv
05/14/2021, 1:17 PMEl Zhang
05/14/2021, 1:19 PMEl Zhang
05/14/2021, 1:19 PMVampire
05/14/2021, 11:13 PMAction
• Make sure it does not have as last statement an expression evaluating to a boolean, so that it cannot match (T) -> Boolean
• Don't use all
but configureEach
El Zhang
05/16/2021, 9:59 AM