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