Beginner’s Guide to Understand Build Gradle Files in Android Studio

An overview of build Gradle files (settings.gradle/.kts, build.gradle/.kts, and gradle.properties) used in Android Studio for beginners

Vincent Tsen
7 min readApr 22, 2023

Build Gradle is a build tool used in Android Studio to build your Android app. It can be written either in Groovy script, or Kotlin script (KTS). KTS is newer than Groovy and eventually, it will replace Groovy.

High-level functions of Build Gradle

  1. Reads app’s build configurations/script s (settings.gradle / settings.gradle.kts and build.gradle / build.gradle.kts)
  2. Downloads and caches app’s dependencies from repositories that you specify in settings.gradle / settings.gradle.kts
  3. Compiles the app’s source code (either Java or Kotlin) into Java Bytecode, followed by Dalvik Bytecode.
  4. Packs the Dalvik Bytecode and resources either into the APK (Android Package) or Android App Bundle

To do all these functions above, the following Gradle build configuration/script files are needed

  • settings.gradle / setings.gradle.kts (root directory)
  • build.gradle / build.gradle.kts (root directory)

--

--