About Configuring JVM memory:
The org.gradle.jvmargs Gradle property controls the VM running the build. It defaults to -Xmx512m "-XX:MaxMetaspaceSize=256m"
The JAVA_OPTS environment variable controls the command line client, which is only used to display console output. It defaults to -Xmx64m
But:
There is one case where the client VM can also serve as the build VM: If you deactivate the Gradle Daemon and the client VM has the same settings as required for the build VM, the client VM will run the build directly. Otherwise the client VM will fork a new VM to run the actual build in order to honor the different settings.
About GRADLE_OPTS:
Specifies JVM arguments to use when starting the Gradle client VM. The client VM only handles command line input/output, so it is rare that one would need to change its VM options. The actual build is run by the Gradle daemon, which is not affected by this environment variable.
Common Android memory issues https://support.circleci.com/hc/en-us/articles/360021812453-Common-Android-memory-issues
Circle CI & Android: 8 advanced configuration tips https://medium.com/dipien/circle-ci-android-configuration-tips-ca0e8148c819
Latest in GU: circleci/circleci-docs#2945 (comment)
Issue with parallel: https://youtrack.jetbrains.com/issue/KT-15562