I just updated the version for Android Studio version 2.0 Preview 8 and gradle 2.0.0-alpha8. I noticed that there is now a warning if the heap of space is not large enough to be deleted.
As stated on the corresponding page ( http://tools.android.com/recent )
In 2.0.0-alpha8, we added some automatic diagnostics for this: if the build process is too small, we return to turning off the memory from the memory and issue a build warning explaining how to raise the gradle daemon. (We are also working on some additional next build after alpha8.)
When I started building my project, I got the following error:
To run dex in the process, a large heap is required for the gradle daemon. It currently has 3641 MB. For faster assembly, increase the maximum heap size for the gradle daemon to more than 4 g, as indicated in dexOptions.javaMaxHeapSize. To do this, set org.gradle.jvmargs = -Xmx4g as specified in dexOptions.javaMaxHeapSize in the gradle.properties project. For more information see https://docs.gradle.org/current/userguide/build_environment.html
In fact, I get a lot of them in a row. Which surprises me, because this is what I see in my gradle.properties file (in my project home directory)
ANDROID_BUILD_TARGET_SDK_VERSION=23 ANDROID_BUILD_TOOLS_VERSION=23 ANDROID_BUILD_SDK_VERSION=23 ANDROID_BUILD_MIN_SDK_VERSION=16 org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=4096m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
also, in build.gradle of my main module, I put
android { dexOptions { incremental true javaMaxHeapSize "4g" } }
so I donβt understand where the builder / dexer / compiler gets this value 3641MB.
Lines are very slow
I turned off instant start, and now everything is faster. 48-50 seconds to build. I still get the same error, but only once and not many times in a row.
I am on Linux, my ulimit -a looks like this:
core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 31483 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 31483 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited
Also, this is my studio.vmoptions file: https://gist.github.com/MarKco/1ae7918daf867a378a2f I assume it is unedited. I may have the usual, but I do not know where this may be.