0

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?

Dmitrii Mikhailov
  • 5,053
  • 7
  • 43
  • 69
  • Just search on google you will find a lot information here is one : http://stackoverflow.com/questions/5936519/how-to-give-jenkins-more-heap-space-when-it%C2%B4s-started-as-a-service-under-windows – Josef Feb 04 '15 at 17:04
  • The problem is that, as you can see in the exception, message, there's `Xmx` option there. And I don't think that changing settings for jenkins app itself will help here, because app building is just another process. Correct me if I'm wrong, please. – Dmitrii Mikhailov Feb 04 '15 at 17:10
  • 1
    Actually I've just tried to build app in linux console and I get the same results. I'm sorry for this misleading about jenkins. The problem is not related to it. I'm just trying to set up automatic builds in jenkins. But it's not working in console too... – Dmitrii Mikhailov Feb 04 '15 at 17:14

0 Answers0