If you enable Gradle Daemons, you can actually reuse the Gradle context that you've just created for your subsequent builds! It basically doesn't completely kill the process when a Gradle build finishes, but reuses the common framework classes and thus improving build time.
I've tried it on my projects and the improvement was from a 40s build down to 20s on subsequent builds !
Here's what you need to do and know:
touch ~/.gradle/gradle.properties && echo "org.gradle.daemon=true" >> ~/.gradle/gradle.properties
- enables Gradle daemon for all your projects by default (don't worry you can turn it off for individual projects as well)
- if you use multiple Gradle versions, a different daemon is created for each one! This is a potential deal-breaker for some developers, but a good reason to align all your projects to a single version of Gradle.
- in case you want to recreate the daemon, you can stop them all using:
./gradlew --stopAnd that's it!
For more info check the dedicated page:
https://docs.gradle.org/current/userguide/gradle_daemon.html