I read a lot of answers to multiple questions like this, but they are all very old and use arcane/obsolete syntax in groovy and/or are not suitable for Android projects.
I have a task.
tasks.register("asd") {
doFirst {
exec {
How do I run it when build starts in an Android app/build.gradle.kts file?
I have printed both tasks and project.tasks names and I have tried
tasks.named("build").dependsOn(":asd")
tasks.named("app:build").dependsOn(":asd")
tasks.named(":app:build").dependsOn(":asd")
project.tasks.named("build").dependsOn(":asd")
project.tasks.named("app:build").dependsOn(":asd")
project.tasks.named(":app:build").dependsOn(":asd")
It either fails with Task <name> not found in project or it does nothing.
I tried with doFirst, doLast and neither (directly exec) and still nothing.