Gradle dependencies resolving suddenly extremely slow

If you are using Android Studio with gradle, for the time being doing

go to android studio -> preferences -> compiler -> gradle -> check offline mode

has improve my build times drastically. Since, I already have latest libraries cached it works

well.


For Newcomers, who can't find that settings (Android studio 1.5.1)
File -> Settings -> Build,execution, deployment -> Build tools -> Gradle
last checkbox (Offline work)

and thanks a lot guys - from like 10 mins to 30sec


I have same problem too and i contacted my provider which tracked trace to www.mvnrepository.com (repository for dependencies) and trace will end on ec2-79-125-0-137.eu-west-1.compute.amazonaws.com [79.125.0.137]

Problem is on amazonaws.com. Here is trace route:

1 < 1 ms < 1 ms < 1 ms private.rionet.cz [172.25.20.1]
2 10 ms 10 ms 9 ms private.rionet.cz [172.28.0.1]
3 11 ms 10 ms 10 ms rio-bb-jsw01-vlan-4050-94-74-192-164.net.rionet.
cz [94.74.192.164]
4 11 ms 10 ms 10 ms sitK9-bb-jsw01-xe-0-1-2-0-188-175-255-85.net.rio
net.cz [188.175.255.85]
5 10 ms 9 ms 10 ms sitK9-bb-jrt01-xe-9-0-0-0-188-175-255-197.net.ri
onet.cz [188.175.255.197]
6 68 ms 10 ms 9 ms prag-b3-link.telia.net [213.248.87.97]
7 15 ms 17 ms 17 ms win-bb2-link.telia.net [213.155.131.68]
8 34 ms 34 ms 34 ms hbg-bb2-link.telia.net [62.115.136.30]
9 92 ms 154 ms 47 ms ldn-bb2-link.telia.net [80.91.247.169]
10 65 ms 64 ms 85 ms dln-b1-link.telia.net [213.155.136.121]
11 70 ms 55 ms 64 ms amazon-ic-300342-dln-b1.c.telia.net [80.239.128.
18]
12 65 ms 64 ms 64 ms 178.236.0.126
13 64 ms 71 ms 64 ms 178.236.0.125
14 66 ms 57 ms 57 ms ec2-79-125-0-137.eu-west-1.compute.amazonaws.com
[79.125.0.137]
15 * * * Vypršel časový limit žádosti.
16 * * * Vypršel časový limit žádosti.
17 * * * Vypršel časový limit žádosti.
18 * * * Vypršel časový limit žádosti.
19 * * * Vypršel časový limit žádosti.
20 * * * Vypršel časový limit žádosti.
21 * * * Vypršel časový limit žádosti.
22 * * * Vypršel časový limit žádosti.
23 * * * Vypršel časový limit žádosti.
24 * * * Vypršel časový limit žádosti.
25 * * * Vypršel časový limit žádosti.

After many hours of searching I found that proxy settings and gradle options have changed in Android Studio 1.5.1. See http://www.laurivan.com/gradlew-and-proxy-authentication/ for more information. Change gradle.properties (Global properties) that lies in C:\Users\.gradle\ to following:

# Speedup
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureondemand=true
# Speedup and proxy settings
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError \
-Dfile.encoding=UTF-8 -Dhttp.proxyHost=xxx.xxx.xxx.xxx -Dhttp.proxyPort=pppp \
-Dhttps.proxyHost=xxx.xxx.xxx.xxx -Dhttps.proxyPort=pppp \
-Dhttp.proxyUser=_username_ -Dhttp.proxyPassword=_password_