Android build failing - Expiring Daemon because JVM heap space is exhausted

Android builds are failing with this error “Expiring Daemon because JVM heap space is exhausted”. If I do the build locally it works.

Hi there @mmajeed! What you’ll need to do here is raise the JVM heap size. You can find instructions on how to do that in our Devcenter .

1 Like

Hi @ahvth-bitrise, I’ve read instruction show in devcenter and after setting up the heap size I am getting below error;

Retrying…
Failed to ensure android components, error: output: Invalid initial heap size: -Xms512m -Xmx1024m
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
error: exit status 1
| |
±–±--------------------------------------------------------------±---------+
| x | install-missing-android-tools (exit code: 1) | 9.79 sec |
±–±--------------------------------------------------------------±---------+
| Issue tracker: …bitrise-steplib/steps-install-missing-android-tools/issues |
| Source: …://github.com/bitrise-steplib/steps-install-missing-android-tools |
±–±--------------------------------------------------------------±---------+

Hey there @yasheshc!

Could you please share your build URL and enable Support Access (Enabling the Bitrise Support user for your app | Bitrise DevCenter) so that we may take a closer look and see what is going on with your build? :slight_smile:

Thanks for very quick reply.

Here build URL : https://app.bitrise.io/build/2751429b8480832e#?tab=log

Hi,

Try specifying -Xms512M -Xmx1024M

Thanks,
Cathy

Still getting same error!

Failed to ensure android components, error: output: Invalid initial heap size: -Xms512M -Xmx1024M

Error: Could not create the Java Virtual Machine.

Error: A fatal exception has occurred. Program will exit.

error: exit status 1

@ahvth-bitrise @Roland-Bak can you please help me on this?

Hi, can you please provide the latest build URL for the latest failed build and enable Support User Access? I would also ask for permission to run a couple of test builds on your account to try and determine the issue.

Here is latest build log URL https://app.bitrise.io/build/3006a97c32d2c0a4#?tab=log

For this project I’ve already enable the support user access.

Yes, I allow to preform test build

Hi there @yasheshc!

It is possible that because you have a cross-platform project and the directory locations are not the same as it would be in a purely android project, you would need to remove the JAVA_OPTS and GRADLE_OPTS Env Vars from your Env Vars tab, and instead directly put the JVM parameters into your gradle.properties file: gradle Tutorial => Tuning JVM Memory Usage Parameters for Gradle

Hope this helps! :wink:

Hi, still facing “Expiring Daemon because JVM heap space is exhausted” even after trying out all the suggested solution.

May i know is there any other updates on solving this issue?

Hi @Jacky9425! We will require further information to address the issue properly, please consider contacting us directly or raising a separate issue thread.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.