0

I am using android studio and i have updated android studio with version 141.1890965. But still my android gradle build is too slpw it take almost 3 minute when i build it for first time and then 1 min 20 sec around. I tried out many solution on google but still i am help less. Following are the links which i tried.

Gradle build is too slow

Building and running app via Gradle and Android Studio is slower than via Eclipse

https://www.timroes.de/2013/09/12/speed-up-gradle/

Android studio Gradle build speed up

Community
  • 1
  • 1
AmitCharkha
  • 209
  • 4
  • 18
  • 1
    You're ab right. i faced too. – M D May 14 '15 at 07:28
  • best (for me) is never to use maven or gradle and stick to eclipse. It is so darn fast comparing with all that stuff... – eduyayo May 14 '15 at 07:39
  • 1
    Please try to explain your question without link references. – ondermerol May 14 '15 at 07:39
  • There is a option called as offline work in Android Studio under settings->Build,execution,Development ->Buildtools -> check offline work. this could make little bit faster. – Muthu May 14 '15 at 07:44
  • @Muthu i tried this solution but still i facing same problem – AmitCharkha May 14 '15 at 09:10
  • @ondermerol Before two month i was using eclipse and was not facing any time consumption while doing build but when i switched to Android studio i am facing time consuming in making build almost one and half minute every time. – AmitCharkha May 14 '15 at 09:15
  • possible duplicate of [android studio 1.2 gradle is very slow](http://stackoverflow.com/questions/30024910/android-studio-1-2-gradle-is-very-slow) – Kuba Spatny May 14 '15 at 09:40
  • @AmitCharkha How fast is your internet. because android studio normally needs a fast stable network connection. and are you using proguard? – Muthu May 14 '15 at 10:03

2 Answers2

0

Already answered this here

Had the same problem.

What I did was to change the global gradle settings to offline work which can be done by going to Preferences => Gradle. This did make a difference.

Another method I have seen people use, but which I have not used yet is to create a gradle.properties in the gradle folder like so:

Just create a file named gradle.properties in the following directory:

/home/<username>/.gradle/ (Linux)
/Users/<username>/.gradle/ (Mac)
C:\Users\<username>\.gradle (Windows)

Add this line to the file:

org.gradle.daemon=true

Please check out this link for more options as well as a detailed explanation on speeding up gradle.

Hope this helps!.

Community
  • 1
  • 1
Smashing
  • 1,640
  • 18
  • 16
  • i tried out both the solution but still i am facing same problem. Even i do one line change in code for build it takes almost 1 minute and 20 or 30 sec. I am facing this problem from last two months – AmitCharkha May 14 '15 at 09:09
0

The reason could be dex,

turn multiDexEnabled to false in your build.gradle file.

android {
...
    defaultConfig {
        ...
        multiDexEnabled false
        ...
    }
}

In addition you should consider to use the lastest version (2.4 at the moment) by editing the gradle-wrapper.properties file and set gradle-2.4-all.zip

distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
sonique
  • 4,539
  • 2
  • 30
  • 39