Android Studio Gradle Build Running is particularly slow, androidgradle
This article uses win7 64bit 6G
Android studio2.1
Gradle Build Running is particularly slow when Running the program, and a helloworld is almost 2 min.
1. enable separate daemon of gradle
Creategradle.properties
File:
/home/<username>/.gradle/
(Linux)
/Users/<username>/.gradle/
(Mac)
C:\Users\<username>\.gradle
(Windows)
Add the following content to the file:
Org. gradle. daemon = true
Modifygradle.properties
Files can also be optimized:
# Project-wide Gradle settings.# IDE (e.g. Android Studio) users:# Settings specified in this file will override any Gradle settings# configured through the IDE.# For more details on how to configure your build environment visit# http://www.gradle.org/docs/current/userguide/build_environment.html# 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.# TODO: disable daemon on CI, since builds should be clean and reliable on serversorg.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=256morg.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_projectsorg.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_demandorg.gradle.configureondemand=true
At the same time, these parameters can be configured in the gradle. properties file in the preceding user directory. This will not take effect for a project, but for all projects.
The above configuration file is mainly used to increase the size of the Java virtual machine running gradle, so that gradle can use an independent process during compilation, so that gradle can run in parallel.
2. Modify the android studio Configuration
In the configuration of android studio, enable the offline mode and modify the configuration. In fact, the configuration is the same as the previous section. The configuration in this section will only take effect during ide build, and the command line build will not take effect.