Accelerate Gradle Build Projects

Source: Internet
Author: User

When building large projects in Gradle, the time-consuming is serious, and the following points can speed up project construction.

1. Upgrade Gradle

Go to the project folder and use the latest gradle. Modify

$project/gradle/wrapper/gradle-wrapper.properties

Replace with the latest.

distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-all.zip
2. Upgrading the Gradle plugin (plugin)

Use the latest Gradle dependencies.

{  dependencies {    classpath ‘com.android.tools.build:gradle:1.5.0‘  }}
3. Set Development Minimum SDK version

At development time, use the minimum SDK version to 21.

{  productFlavors {    dev {        minSdkVersion 21    }    {        minSdkVersion 14    }  }}

The Project Generation APK package is divided into two steps, the first to convert Dex, and the second to synthesize Dex, but version 21+ uses the Android runtime (Android Runtime) to generate the APK and does not need to merge Dex, so the speed can also solve the 65K method.

4. Add Gradle Property

Modifygradle.properties

org.gradle.daemon=trueorg.gradle.parallel=trueorg.gradle.jvmargs=-Xmx768m
5. Using the incremented Dex

Increase the capacity of Dex. Reference.

dexOptions {    true}

That ' s all! If the project is built too slowly, according to the actual situation, choose to optimize the combination of gradle.
OK, Enjoy it!

Accelerate Gradle Build Projects

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.