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
- Ways to optimize the efficiency of Android Studio compilation
- Problems with Android Studio and the resolution process
Androidstudio Optimizing Gradle Compilation efficiency