How to speed up the Gradle build time in Android Studio (“Gradle Build Running”)

Probably each Android developer have noticed that the Gradle build time became extremaly slow in recent versions of Android Studio. This makes running the application in debug mode could be quite painful…

Perhaps you have seen the below message many times:


(…and you googled this page, because you hate it!)

No worries! There are a couple of tricks to make this process faster:

Use a deamon to run the build

You can tell Android Studio to use the Gradle Deamon. It is a long-lived background process that executes your builds much more quickly than would otherwise be the case (see documentation for more details).

You just need to edit the following file (or create it, if not exists):

/home/<username>/.gradle/ (Linux)
/Users/<username>/.gradle/ (Mac)
C:\Users\<username>\.gradle (Windows)

..and add the following line:


Gradle offline mode

You can also set gradle to “offline mode” to force Gradle to use the dependencies from the local cache and do not let them to use the network for dependency resolution (see documentation for more details).

Go to File > Settings… > Build, Execution, Deployment > Gradle
…and select “Offline work” checkbox.

It would speed up the build process a lot. However the build will fail, when the dependencies will not be resolved using the cached resources (e.g. when you’re adding a new dependency). No worries – Android Studio will inform you about that.


These changes helped me to reduce the build process time from few minutes to just a couple of seconds(!). Hope, your results will be similar! 🙂

Do you know any other tricks to speed up the build? Please leave a comment…

Posts created 16

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top