28. June 2017

How to speed up Gradle build in Android Studio caused by problems with proxy

Update: This article targets one particular scenario when Android builds are too slow. There might be other reasons behind your slow build. Let me know if you need assistance. Now back to original article.

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.