Android Studio Gradle Build Running is particularly slow, androidgradle

Source: Internet
Author: User

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.propertiesFile:

  • /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.propertiesFiles 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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.