How to optimize gradle build performance regarding build duration and RAM usage?

后端 未结 9 1390

I am currently switching from ant to gradle for my multi module web application and at the moment it seems that the current version of Gradle (M9) might be running up agains

9条回答
  •  遥遥无期
    2020-12-02 11:48

    I am using following version of gradle.properties to make Gradle performance better in Android projects

    # The Gradle daemon aims to improve the startup and execution time of Gradle.
    # When set to true the Gradle daemon is to run the build.
    org.gradle.daemon=true
    
    # 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
    
    # Enables new incubating mode that makes Gradle selective when configuring projects.
    # Only relevant projects are configured which results in faster builds for large multi-projects.
    # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:configuration_on_demand
    org.gradle.configureondemand=true
    

提交回复
热议问题