Skip to main content



DSL reference:


Basic help: ./gradlew help

CLI options/help: ./gradlew --help


Upgrade the wrapper: ./gradlew wrapper --gradle-version=6.7.1

This updates gradlew, gradlew.bat, gradle/wrapper/gradle-wrapper.jar and gradle/wrapper/

After upgrading ./gradlew --version should show the new version.


List tasks: ./gradlew tasks or ./gradlew Task :help. Note that this does not list all the tasks. To see 'Other tasks' run ./gradlew tasks --all.

Run task: ./gradlew <task>. To see what it would do if run do ./gradlew <task> --dry-run, which shows the tasks dependencies that would be executed.

Task help: ./gradlew help --task <task>


./gradlew clean

./gradlew cleanBuildCache - Doesn't work on Android

Clear Gradle global cache (when clean and 'Invalidate Caches / Restart' don't work):

ls ~/.gradle/caches/
rm -rf ~/.gradle/caches/build-cache-*

Clear local .gradle folders:

find . -type d -name ".gradle"
find . -type d -name ".gradle" -exec rm -rf {} +

Deep clean

find . -type d -name "build"
find . -type d -name "build" -exec rm -rf {} +

find . -type f -name "*.iml"
find . -type f -name "*.iml" -exec rm -rf {} +

find . -type d -name ".idea"
find . -type d -name ".idea" -exec rm -rf {} +



About --profile on the docs:

Generates a high-level performance report in the $buildDir/reports/profile directory. --scan is preferred.

You can do ./gradlew --profile or ./gradlew clean build --profile. On Android you can do ./gradlew assembleDebug --profile.


./gradlew --profile --offline --rerun-tasks assembleDebug
./gradlew --profile --offline --rerun-tasks --max-workers=4 assembleDebug


Example of how to use it:


Enabled by default since 3.X. Always enable the daemon since it makes builds start faster (JVM startup time is bad). To do so add org.gradle.daemon=true to

Gradle will kill any Daemon that has been idle for 3 hours or more, so you don’t have to worry about cleaning them up manually.

List daemons: ./gradlew --status

Alternatively, you can also view the Gradle daemons by printing out all the java processes on the system and the process id (source): jps

Kill daemons: ./gradlew --stop

Note that this kills daemons for the with the current Gradle version (source). To kill all daemons regardless of version do pkill -f '.*GradleDaemon.*'.

Daemon processes will automatically terminate themselves after 3 hours of inactivity or less. If you wish to stop a Daemon process before this, you can either kill the process via your operating system or run the gradle --stop command. The --stop switch causes Gradle to request that all running Daemon processes, of the same Gradle version used to run the command, terminate themselves.