Gradle dependencies resolving suddenly extremely slow
Asked Answered
A

7

24

I am developing Android project with Android Studio and gradle. Till yesterday, gradle build was building relatively fast in a few seconds. Since today, it suddenly became 5 minutes per build.

I gave bigger size on gradle VM but still has no hope.

Could anyone give me any tips what is going on and how to solve this?

Android Studio: 0.4.6 Gradle: 1.9

enter image description here

build.gradle

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:0.7.3+'
    }
}

apply plugin: 'android'

repositories {
    maven {
        url 'https://github.com/Goddchen/mvn-repo/raw/master/'
    }
    mavenCentral()
}

dependencies {
    compile 'com.android:volley:1.0'
    compile 'com.android.support:support-v13:13.0.+'
                .....
}
Allister answered 21/3, 2014 at 5:17 Comment(1)
I have the same problem and my co developer has it also. I tried to upgrade gradle, but that wasn't the problem. The build here takes around 22 minutes..Alric
F
8

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.
Fluter answered 21/3, 2014 at 12:42 Comment(2)
Weird, on the AWS status board, there is no problem status.aws.amazon.com/?nc1=h_su_sdAlric
wow never thought this is an aws issue. Thank you for the help.Allister
A
22

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.

Advertent answered 21/3, 2014 at 16:53 Comment(1)
In Android Studio version 0.5+ is other way to this settings. Settings -> gradle -> check "Offline work"Fluter
F
8

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.
Fluter answered 21/3, 2014 at 12:42 Comment(2)
Weird, on the AWS status board, there is no problem status.aws.amazon.com/?nc1=h_su_sdAlric
wow never thought this is an aws issue. Thank you for the help.Allister
M
5

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

Mercantilism answered 9/12, 2015 at 10:38 Comment(0)
J
3

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_
Jos answered 27/1, 2016 at 12:24 Comment(0)
A
2

I had the same problem, and spent a lot of time to find the reason. As I noticed, in offline mode gradle builds significantly faster.

After few days of research I found, that reason was incorrect repository in project settings. In my case it was

http://clinker.47deg.com/nexus/content/groups/public

The solution is delete incorrect repository in project settings: enter image description here

Aside answered 6/3, 2016 at 17:46 Comment(0)
D
1

My problem was my proxy settings. Our private maven repository url was failing an ssl check because of my Charles configuration.

Dniren answered 5/10, 2017 at 20:46 Comment(1)
We have a private Artifactory repository and use Gradle dependency management. My password changed recently, and I needed to update the STS Window>Preferences>General>NetworkConnections>ProxyEntries preference with the new password value.Hamrah
R
1

Its may be due to resolving Github maven dependencies as all other dependencies are being looked into your repository which takes time, you can filter your repository by only looking into your dependency by following native gralde support i.e

Repository to dependency matching

It is now possible to match repositories to dependencies, so that Gradle doesn't search for a dependency in a repository if it's never going to be found there.

Example:

repositories {
    maven {
        url "https://repo.mycompany.com"
        content {
           includeGroupByRegex "com\\.mycompany.*"
        }
    }
}

for further reference Gradle 5.1.1

Roquefort answered 28/8, 2019 at 7:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.