Android build exceeded the memory limit


My company is testing circleci with Android for now. So far so good. However, if we set “minifyEnabled” to false, we always get this error on build machine. Our local build is OK with this option.
Could you help us with issue? In theory, our project should not take so much memory in build
Any solution for this situation?

“Your build has exceeded the memory limit of 4G on 1 container. The results of this build are likely invalid. We have taken a snapshot of the memory usage at the time, which you can find in a build artifact named memory-usage.txt. The RSS column in this file shows the amount of memory used by each process, measured in kilobytes.”


I am also having an issue exceeding the memory limit of 4G, but the build passes locally. Any idea how to debug the issue?