I would suggest running all three methods along with some dexOptions of the android gradle plugin:
I have the following gradle.properties file:
org.gradle.daemon=true org.gradle.jvmargs=-Djava.awt.headless=true -Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 org.gradle.parallel=true
I also have dexOptions in the app / build.gradle file :
dexOptions { incremental true javaMaxHeapSize "4096M" jumboMode true maxProcessCount 8 preDexLibraries false threadCount 8 }
You can configure these values ββfor your system. Here is more detailed information about these options:
dexInProcess - run the dx compiler as a separate process or inside the gradle JVM daemon.
javaMaxHeapSize . Specifies the value -Xmx when dx is called. The approximate value is "2048 m".
jumboMode Turn jumbo mode on dx (--force-jumbo).
maxProcessCount . The maximum number of concurrent processes that can be used for dex. The default is 4.
preDexLibraries - be it pre-dex libraries. This can improve incremental builds, but clean builds can be slower.
threadCount . The number of threads to use when starting dx. The default is 4.
Ray hunter
source share