Androidstudio optimizes gradle compilation efficiency and androidstudiogradle

Source: Internet
Author: User

Androidstudio optimizes gradle compilation efficiency and androidstudiogradle

Androidstuido uses gradle for Automatic Build and compilation. Sometimes it takes too long to compile a small amount of modifications. Recently, Boosting the performance for Gradle in your Android projects compiled by Erik Hellman (see article 1) the Optimization Method for this problem is mentioned.

1. Upgrade gradle to 2.4.

2.4 has been optimized in terms of compilation performance to improve compilation efficiency.

Add a task in the build. gradle file of your project (not the build. gradle file in the app). The Code is as follows:

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

Note:
Open terminal and enter./gradlew wrapper. Then, gradle automatically downloads version 2.4, or manually downloads the gradle mv to the gradle path on the gradle official website.
The default ubuntu path is ~ /. Gradle/wrapper/dists/

2. Add daemon and compile in parallel

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

3. Search for Gradle in File-> Settings and make the following changes (specify the location of the gradle to be manually downloaded). Otherwise, gradle will be downloaded from the Internet each time it is loaded, which means we can see that gradle is stuck.

Modify the red section above to select offine work for the grale-2.4 you downloaded

Experience, and find that the compilation performance is slightly improved.

Reference

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.