The Kotlin DSL version should largely be the same.
One point is, that you cannot use the type-safe accessor
android
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 { ...} }