android studio 1.2 gradle 很慢 [英] android studio 1.2 gradle is very slow
问题描述
我使用 Android Studio 已经有一段时间了,直到现在我使用的是 1.0.1,gradle 有点慢, assembleDebug 大约 1.5 分钟(我的项目真的很大!)但是今天我将我的 AS 更新到 1.2,现在同样的过程需要大约 7 到 10 分钟,有时甚至没有结果!
it's been a while that I'm using Android Studio, and up until now I was using 1.0.1, gradle was a bit slow, around 1.5 minute for assembleDebug (my project is really big!) but today I updated my AS to 1.2 and now same process takes about 7 to 10 minutes, and sometimes even with no result!
是否需要更改任何设置以使其更快?老实说,每次调试运行 10 分钟是一场噩梦!
is there any setting I have to change to make it faster ? honestly taking 10 minute for every debug run is a nightmare !
而且在大多数情况下,我的 CPU 使用率约为 10%!(其实是闲着的!)因为之前 gradle 工作时它几乎一直都是 100%
Also most of the time, my cpu usage is arround 10 percent! (it is actually idle!) cause before when gradle was working it was on 100% almost all the time
推荐答案
遇到了同样的问题.
我所做的是将全局 gradle 设置更改为离线工作,这可以通过转到 Preferences => Gradle 来完成.这确实有所作为.
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.
我见过人们使用但我还没有使用的另一种方法是创建一个 gradle.properties 在 gradle 文件夹中,如下所示:
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.properties 的文件:
Just create a file named gradle.properties in the following directory:
/home/<username>/.gradle/ (Linux)
/Users/<username>/.gradle/ (Mac)
C:\Users\<username>\.gradle (Windows)
将此行添加到文件中:
org.gradle.daemon=true
请查看 此链接提供更多选项以及有关加速gradle的详细说明.
Please check out this link for more options as well as a detailed explanation on speeding up gradle.
希望这会有所帮助!
这篇关于android studio 1.2 gradle 很慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!