Speed Up Gradle Build

2016-05-01  本文已影响313人  HunkDeng

First of all, upgrade your Android Studio to 2.1.0 and use android gradle plugin version to 2.1.0. It will help you open following features as default. You can see more information in here.

Then we can start:
1.Enable offline mode in your Android Studio.

Highlight with shit color...

2.Configure your gradle.properties file, normally I will put it under project root folder. (I don't have one, how to create it?)
Add following statements in your gradle.properties

# 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=-Xms512m -Xmx1024m -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

org.gradle.workers.max=4

That's all. Thanks for reading!
My personal project commit for this

上一篇 下一篇

猜你喜欢

热点阅读