Android Stuido as Google's main push IDE, with Gradle compilation, there are many advantages and convenience. The only use of the process of uncomfortable place is puzzling, often in the Gradle build when the card is forced to restart the computer, very silent, my machine is 8G memory new machine also did not open other programs. In short, it is very slow to compile and sometimes it often dies. Tried a lot of optimization scheme, the number of cards die less compilation is also a lot faster. Share my findings with you.
increase running memory and optimize compilation
Take PC-side for example, Mac is similar
1. Request Large Memory
Installation Path\studio64.exe.vmoptions or Studio.exe.vmoptions
Open with a text editor and find the starting two lines, as follows
-xms128m
-xmx750m
Modify minimum and maximum values, recommended for
-xms256m
-xmx2048m
2 Optimizing compilation
A:
File->setting->compile
Tick other options except for the second item and fill in the VM options:
-xmx2048m-xx:maxpermsize=512m-xx:+heapdumponoutofmemoryerror-dfile.encoding=utf-8
B:
C:\Users\yourname\.gradle
Open the gradle.properties with a text editor, and edit the following:
Org.gradle.daemon=true
Org.gradle.jvmargs=-xmx2048m-xx:maxpermsize=512m-xx:+heapdumponoutofmemoryerror-dfile.encoding=utf-8
Org.gradle.parallel=true
Org.gradle.configureondemand=true
Set in setting
At the same time in Android studio total settings, such as:
1.offline work Tick
2.updates inside a few hooks to remove
Android Studio running, compiling a dead-end solution