简体   繁体   中英

Gradle Build is very slow

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

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!.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM