继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

Android提高gradle编译速度

jmesSehng
关注TA
已关注
手记 149
粉丝 424
获赞 5663
分配更大的存储空间提高速度
1.配置全局的gradle的
2.查找gradle.properties文件路径

我的是mac环境在home目录下的.gradle文件夹下,如果没有新建gradle.properties

3.设置内容
# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
#org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true
org.gradle.daemon=true
org.gradle.configureondemand=true
org.gradle.jvmargs=-Xmx4096m
org.gradle.java.home=/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home
4.注意事项

具体的项目下面的buuld.gradle文件配置,里面的javaMaxHeapSize要比上面的org.gradle.jvmargs=-Xmx4096m小

dexOptions {
    dexInProcess = true
    javaMaxHeapSize “3g"
    preDexLibraries = false
    incremental true
  }
打开App,阅读手记
7人推荐
发表评论
随时随地看视频慕课网APP

热门评论

全局的gradle设置会影响module的gradle

查看全部评论