Android build gradle is too slow (Dependency Resolution)
The problem is solved !
After 2 days searching , I got the solution , so I would like to share with all people who may have the same problem. The problem is gradle
can not connect to center repository in some country. When you create a new project or import , your center repository is jcenter()
by default and whenever you want to build or sync or add new external dependency, gradle
is going to connect to https://bintray.com/ but it can not and the building process is going to wait till connect to jcenter()
, so this process might take long time ( +30 min ) , even you can not add new dependency .
Solution :
- Make sure you have latest stable version ( current 2.0.0 )
- Make sure your gradle version is 2.0.0 in build.gradle (
classpath 'com.android.tools.build:gradle:2.0.0'
) - Final step and most important one is change your jcenter() to mavenCentral()
So you can easily add new dependency and sync project under 3sec !
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Have Fun
Gradle dependencies resolving suddenly extremely slow
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.
Android Studio gradle takes too long to build
Found the reason!! If Android Studio has a proxy server setting and can't reach the server then it takes a long time to build, probably its trying to reach the proxy server and waiting for a timeout. When I removed the proxy server setting its working fine.
Removing proxy: File > Settings > Appearance & Behavior > System settings > HTTP Proxy
Android Studio stuck on gradle resolving dependencies
Killing the process or restarting the system helped me. Now it works perfectly fine...
P.S: A quote from the sitcom The IT Crowd:
Did you try turning it off and on again?
Slow build gradle in android
Try to update AndroidStudio to 3.0, upgrade gradle gradle:2.2.3 => gradle:3.0.0 and buildtools buildToolsVersion '25.0.2' => buildToolsVersion '26.0.2'
Related Topics
Is Discard Bad for Program Performance in Opengl
Remove Android Default Action Bar
How to Find Android Textview Number of Characters Per Line
How to Execute Background Task When Android App Is Closed/Set to Background
Android: Refreshing The Gallery After Saving New Images
Programmatically Lock into Portrait Mode for Certain Operations
Hide Tablayout on Scroll of Content Instead of Toolbar
Fab Animation with Viewpager/Tabslider
Margins of a Linearlayout, Programmatically with Dp
Changing Numberpicker Divider Color
Ble Scan Is Not Working When Screen Is Off on Android 8.1.0
Android: How to Get a Modal Dialog or Similar Modal Behavior
Does Android Studio Have a Hierarchy Viewer or Layout Inspector
Animation for Expandablelistview