Android Studio gradle takes too long to build

Update 2022; Google removed “Offline work” option;

They added “Donwload external annotations for dependencies” option, but of course unchecking that option does not provide the same speed improvements.

Answer

In Android Studio go to
File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle

(if on mac) Android Studio -> preferences… -> Build, Execution, Deployment -> Build Tools -> Gradle

Check the ‘Offline work’ under ‘Global Gradle settings’

Note: In newer version of Android studio, View->Tool Windows->Gradle->Toggle button of online/offline

It will reduce 90% gradle build time.

check this to reduce build time

if you just added a new dependency in your gradle you will have to uncheck the offline work or gradle will not be able to resolve the dependencies. After the complete resolving then you you can check the offline work for a faster build

Leave a Comment