How to speed up Gradle build in Android Studio

Gradle build should be fast. Even when you build C++ dependencies for Android.

Unfortunately, it often happens that builds take forever and Gradle is not providing any hint how to speed up the build.

One of the most common reasons is that Gradle is trying to download many dependencies. This will take some time even on a fast network. If you’re behind proxy it might take forever.

A quick way to improve performance is to switch Gradle to offline mode.

Go to File, Settings.

Search for “work offline”, check Work offline option and click Ok.

Next Gradle sync or build should be at least 10 times faster.

Once you’ve proved that you have this issue, go to Settings and update Proxy configuration which matches your network.

Enjoy faster builds 🙂

If you’re still facing slow builds let me know.

No votes yet.
Please wait...

28. June 2017 at 19:02 - Software engineering (Tags: , , , , ).