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