Cannot allocate memory

Hello,

I have sometimes an issue with my Android build when I execute ./gradlew :app:assemblePrimaryDebugCi -PdisablePreDex --max-workers 2 I encounter this erreor 40% of the time : java.io.IOException: Cannot allocate memory

My config.yml for this task:
- run:
name: Assemble Debug
command: ./gradlew :app:assemblePrimaryDebugCi -PdisablePreDex --max-workers 2
environment:
GRADLE_OPTS: -Xmx1024m -Xms768m
TERM: dumb

What are the good settings to let my build pass ?

Hi there. This blog posts explains all the options and how they can affect your jobs: https://circleci.com/blog/how-to-handle-java-oom-errors/