How to run a Gradle Kotlin DSL build task in Android Studio


A step by step guide on running a Kotlin Gradle pre-build task in Android Studio.
Step One: Select a Gradle file

Select the Gradle file you wish to run your task in.
Step Two: Add the Task

Add the task to the gradle file, using code similar to the one available below.
Step Three: Test

Sync your Gradle, and confirm that the task is ran.
Looking for more information on Gradle Kotlin DSL?
Please consult the Gradle Kotlin DSL primer linked below.
Looking to run a task at any stage of the build ?
Consult our guide below to learn how to run a task at any stage of a Gradle's build.
Any Questions?
We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.