Androidstudio Optimizing Gradle Compilation efficiency

Source: Internet
Author: User

Androidstuido use Gradle to build and compile automatically, sometimes do a small amount of modification to compile the time to wait too long, recently Erik Hellman written boosting the performance for Gradle in your Android Projects (reference 1) mentions the optimization method for this problem.

Upgrade of 1.gradle to 2.4.

2.4 Did a lot of optimization in compiling performance, improve the efficiency of compiling.

In your project Build.gradle file (not the app's Build.gradle file), add a task with the following code:

task wrapper(type: Wrapper) {
gradleVersion = ‘2.4‘
}

Attention
Then open terminal, enter./gradlew wrapper, then Gradle will automatically download version 2.4, or go to the Gradle official website manually download and then put the Gradle mv to the Gradle path.
Ubuntu default path under ~/.gradle/wrapper/dists/

2. Adding daemons, compiling in parallel

Add the gradle.properties in the project
Org.gradle.daemon=true
Org.gradle.parallel=true

3.File-Settings Search Gradle, make the following changes (specify the location of the manual download Gradle), or each time the load will be downloaded from the Internet gradle, that is, we see the gradle stuck problem.

Modify the red section above for your download grale-2.4 choose Offine work

Experience, and found that the performance of the compilation slightly increased.

Reference
    1. Ways to optimize the efficiency of Android Studio compilation
    2. Problems with Android Studio and the resolution process

Androidstudio Optimizing Gradle Compilation efficiency

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.