The problem is that on my laptop all 4Gb operatives and to buy will not work (the laptop is old).
So you have to shamanism with the settings gradle. Basically, I have free about 2.5 GB, swap do not want to use.
Tried to set the following build settings in Studio in dialog for Gradle-Android Compiler:
--parallel --max-workers=2 --no-rebuild-Dorg.gradle.jvmargs=-Xmx1536m

Also tried to set the settings in the file $HOME_DIRECTORY/.gradle/gradle.properties:
org.gradle.parallel=false
org.gradle.daemon=true
org.gradle.jvmargs=-Xms1024m -Xmx1024m -XX:MaxPermSize=512m
org.gradle.configureondemand=false
org.gradle.workers.max=1
Also tried to set the settings in the gradle file.properties in the draft:
org.gradle.jvmargs=-Xms1024m -Xmx1024m -XX:MaxPermSize=512m
Environment variables are also tried to install:
GRADLE_OPTS=-Xmx1024m
In any case, it did not help, the process was trying to eat all available system resources and even more.
Question:
where you should change the project settings?