Gradle编译加速
查看执行Gradle具体的消耗时间
gradlew --profile
设置编译加速
在window系统目录C:\Users<username>.gradle (Windows),创建gradle.properties文件,包含以下内容:
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.configureondemand=true
同时修改项目下的gradle.properties文件也有优化效果
org.gradle.configureondemand=true
3.在mudole 里面的build.gradle文件中设置:
androiod{
dexOptions {
//使用增量模式构建
incremental true
//最大堆内存
javaMaxHeapSize "8g"
//是否支持大工程模式
jumboMode = true
//预编译
preDexLibraries = true
//线程数
threadCount = 8
}
}