Androidstudio Optimizing Gradle Compilation efficiency

Source: Internet
Author: User

Androidstuido uses Gradle to build and compile on its own initiative. Sometimes do a small amount of changes to compile to wait too long, recently Erik Hellman written boosting the performance for Gradle in your Android projects (translation 1) mentioned the optimization method of 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, code such as the following:

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

Attention
Then open terminal, enter./gradlew wrapper, then Gradle will take the initiative to download the 2.4 version number. Or go to the Gradle website and manually download the Gradle mv to the Gradle path.
Ubuntu default path under ~/.gradle/wrapper/dists/

2. Join the daemon and compile in parallel

Join in the gradle.properties of the project
Org.gradle.daemon=true
Org.gradle.parallel=true

3.File-Settings Search Gradle, do such as the following changes (specify the location of the manual download Gradle), or each time the download of the membership from the Internet gradle, that is, we see the gradle stuck problem.

Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvz3rzb25n/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70 /gravity/southeast "alt=" here to write a picture descriptive narrative "title=" ">

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

Experience it for yourself. Found a slight improvement in compilation performance.

References
    1. p=585 "> How 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.