[英]Gradle Build is very slow
I am using android studio and i have updated android studio with version 141.1890965. 我正在使用android studio,并且已经用141.1890965版本更新了android studio。 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. 但是我的android gradle构建仍然太慢了,当我第一次构建它时花了将近3分钟,然后是20分钟左右的1分。 I tried out many solution on google but still i am help less. 我在Google上尝试了许多解决方案,但仍然没有太多帮助。 Following are the links which i tried. 以下是我尝试过的链接。
Gradle build is too slow Gradle构建太慢
Building and running app via Gradle and Android Studio is slower than via Eclipse 通过Gradle和Android Studio构建和运行应用程序比通过Eclipse慢
https://www.timroes.de/2013/09/12/speed-up-gradle/ https://www.timroes.de/2013/09/12/speed-up-gradle/
Android studio Gradle build speed up Android Studio Gradle构建加快
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. 我所做的是将全局gradle设置更改为脱机工作,这可以通过转到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: 我见过人们使用的另一种方法,但尚未使用的方法是在gradle文件夹中创建gradle.properties ,如下所示:
Just create a file named gradle.properties in the following directory: 只需在以下目录中创建一个名为gradle.properties的文件:
/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. 请查看此链接以获取更多选项以及有关加速gradle的详细说明。
Hope this helps!. 希望这可以帮助!。
The reason could be dex, 原因可能是dex,
turn multiDexEnabled
to false in your build.gradle
file. 在build.gradle
文件multiDexEnabled
为false 。
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 另外,您应该考虑通过编辑gradle-wrapper.properties
文件并设置gradle- 2.4 -all.zip使用最新版本(当前为2.4)。
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.