Skip to content
BENIBIX Learn

Gradle

Development🛠️ Editors & ToolsBuild Automation

Also known as Gradle Build Tool, gradlew, build.gradle

A free build tool for Java, Kotlin and Android. Its recipe file is code.

Think of it like

It is like a recipe card you can add your own steps to.

Example

Jack builds an Android app. He types ./gradlew build, and Gradle compiles the app, runs the tests and makes the app file.

Why it matters

Android apps are built with it. If you build for Android, you work with Gradle every day.

Definition

Gradle is a free build tool used most for Java, Kotlin and Android apps. The steps live in a file called build.gradle.kts, written in Kotlin, or build.gradle, written in Groovy. Because the file is code, you can add your own steps. It skips work that has not changed, so later builds are fast. Projects ship a small script called gradlew that fetches the right Gradle version.

Example code

console
$ ./gradlew build
BUILD SUCCESSFUL
The gradlew script fetches the right Gradle, then builds and tests the project.
Gradle is the build tool whose recipe is a build.gradle.kts file.

Common mistake

Running a gradle you put on your computer yourself. Use ./gradlew, since the project may need its own version.

Key takeaways

  1. 1
    Code as recipe. The build file is Kotlin or Groovy.
  2. 2
    Skip done work. Unchanged steps are not run again.
  3. 3
    Use the wrapper. gradlew picks the right version.

Compare

Learn it properly