Sometimes we are getting errors of shortage of memory at the compile time.
We get such type of error:
Exception in thread "pool-1-thread-2" Exception in thread "pool-1-thread-3"
Exception in thread "pool-1-thread-4" java.lang.OutOfMemoryError: GC overhead limit exceeded
So as to limit or exceed Dex memory usage, we need to set the dexOptions.javaMaxHeapSize configuration to whatever value we need.
The default javaMaxHeapSize appears to be a little over 1 GB.
Below is the code that we need to add in the gradle file
dexOptions {
javaMaxHeapSize "4g"
}
We can also speed up by turning on incremental dexing like this
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
Hope it will help you.
0 Comment(s)