How to run a Gradle Kotlin DSL build task in Android Studio
![Oscar de la Hera Gomez](https://www.delasign.com/CDN/headshots/profile.webp)
![Two flowers that represent Kotlin and Android Studio. Beneath it sits the text "Pre-Build Kotlin Gradle DSL Task."](https://www.delasign.com/CDN/images/How-to-run-a-Kotlin-Gradle-DSL-pre-build-task-in-Android-Studio.webp)
A step by step guide on running a Kotlin Gradle pre-build task in Android Studio.
Step One: Select a Gradle file
![A screenshot of Android Studio highlighting the location of the Gradle files.](https://www.delasign.com/CDN/images/Select-a-Gradle.webp)
Select the Gradle file you wish to run your task in.
Step Two: Add the Task
![A screenshot of Android Studio showing a Hello World task in a gradle file.](https://www.delasign.com/CDN/images/Add-Task.webp)
Add the task to the gradle file, using code similar to the one available below.
Step Three: Test
![A screenshot of Android Studio showing the "Hello World" being printed out in the Gradle Build Terminal.](https://www.delasign.com/CDN/images/Run_2023-06-08-170230_vrje.webp)
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.