摇篮打造慢得令人难以置信 [英] Gradle build incredibly slow
问题描述
打造,现在时间不等左右〜2-4分钟。
Build time right now is ranging around ~2-4 min.
我使用的是通过提供摇篮约11库。
I'm using about 11 libraries provided via Gradle.
我有以下设置:
buildTypes {
debug {
multiDexEnabled = true
applicationIdSuffix ".debug"
minifyEnabled false
proguardFile 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4096M"
preDexLibraries false
jumboMode = true
incremental = true
}
摇篮:离线模式
我在gradle.properties以下设置 org.gradle.jvmargs = -Xmx4096m -XX:MaxPermSize参数=1024米-XX:+ HeapDumpOnOutOfMemoryError -Dfile.encoding = UTF-8
I have the following setting in gradle.properties
org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
在全局属性我有:
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureondemand=true
我已经通过大约每一篇文章我能找到它在谷歌/看#1
I've looked through about every article I can find on it on Google/Stackoverflow.
有什么办法来加快进程,以分钟低于1至少?
Is there any way to speed the process up to below 1 minute at least?
更新2015年8月6日
这真的帮了速度的东西为我说话。
These really helped speed things up for me.
gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip
的build.gradle 项目依赖
classpath 'com.android.tools.build:gradle:1.3.0'
更新2015年8月9日
我发现,因为它原来使用 Protoc 是非常非常慢为Android。我切换到线并花了编译时间从2分钟。以10S-30S。
I've found that as it turns out using Protoc is very very slow for Android. I switched to Wire and it took the compilation time from 2 min. to 10s-30s.
推荐答案
我发现 multiDexEnabled = TRUE
让我的构建过程非常缓慢。我不知道这是否是可以改善它的性能在某种程度上,但现在我只是把它关闭。
I found that multiDexEnabled = true
makes my build process extremely slow. I don't know if it's possible to improve it's performance somehow, but for now I just turned it off.
您必须使用它只有在你的项目中(包括库)方法金额超出65K的限制。也许你可以切断你的一些11库,然后关闭 multiDexEnabled
选项应该解决您的问题。
You have to use it only if amount of methods in your project (including libraries) goes beyond 65k limit. Maybe you can cut off some of your 11 libraries, then turning off multiDexEnabled
option should solve your problem.
这篇关于摇篮打造慢得令人难以置信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!