Victor Kabata
10/03/2022, 10:31 AMbuild.gradle(project)- top level
subprojects {
afterEvaluate {
if (project.hasProperty('android')) {
android.buildTypes { project -> // This part
debug {...}
release{...}
... // Other build types
}
}
}
}Vampire
10/03/2022, 11:05 AMandroid as that only works with plugins you applied in the same script using the plugins DSL.
This is mainly a hint that you should not do what you do. Using afterEvaluate is evil, except for rare cases, using subprojects { ... } or allprojects { ... } is evil, using the legacy apply to apply a plugin is evil. If you really insist on using that bad-practice style, you need to get the Android extension by type, for example the<WhateverTypeTheAndroidExtensionHas>().buildTypes { ...} or configure<WhateverTypeTheAndroidExtensionHas> { buildTypes { ...} }Victor Kabata
10/03/2022, 12:37 PMVampire
10/03/2022, 6:20 PMsubprojects { ... }, then use convention plugins, for example as precompiled script plugin, then apply the convention plugin where you want its effects to be present.