I'm trying to build an android app in jenkins. I have pretty VMs with pretty much the same configurations (at least they have the same amount of RAM) but one of them is returning this:
java.lang.OutOfMemoryError: Java heap space
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':MyApp:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/opt/android-sdk-linux/build-tools/21.1.2/dx -JXmx1g --dex --no-optimize --multi-dex --main-dex-list /var/lib/jenkins/workspace/Build MyApp/MyApp/build/intermediates/multi-dex/debug/maindexlist.txt --output /var/lib/jenkins/workspace/Build MyApp/MyApp/build/intermediates/dex/debug --input-list=/var/lib/jenkins/workspace/Build MyApp/MyApp/build/intermediates/tmp/dex/debug/inputList.txt
Well, I guess I should provide more than 1GB to this dx build tool, but how can I do that? How can I pass -Xmx
option to Gradle to use it instead of -JXmx1g
?