From d0d1b095011c2ead548c6db6154c5bc1e5b6f4de Mon Sep 17 00:00:00 2001 From: David Maldonado <38918425+dtrdic@users.noreply.github.com> Date: Mon, 2 Dec 2024 10:28:39 +0100 Subject: [PATCH] java heap error workaround update (#2859) * java heap error workaround update * added code example * add sentence for WFE --- .../troubleshooting/common-android-issues.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/content/troubleshooting/common-android-issues.md b/content/troubleshooting/common-android-issues.md index 927afcfb..228d74d6 100644 --- a/content/troubleshooting/common-android-issues.md +++ b/content/troubleshooting/common-android-issues.md @@ -88,8 +88,22 @@ Builds fail with the below error: Java Heap space error is a well-known issue and can be thrown for multiple reasons e.g. enabling ProGuard or DexGuard requires more power to complete the tasks. Here are some suggested solutions to try: -1. Upgrading to the latest version of Gradle in the `gradle-wrapper.properties` file and the Android Gradle plugin in the `android/build.gradle` file to the latest version could help fix the issue. You can refer to the Official Documentation from Android Developer guides to learn more about the latest compatible version [here](https://developer.android.com/studio/releases/gradle-plugin#updating-gradle). -2. Set the maximum heap size by adding **-Dorg.gradle.jvmargs="-Xmx4096m"** to the build command or you can add the following line in **android/gradlew**: +1. Set **JAVA_TOOL_OPTIONS: "-Xmx5g"** as an environement variable. This allows the JVM to use up to 5 GB of memory, which can help prevent memory allocation errors. + +{{< highlight yaml "style=paraiso-dark">}} + workflows: + android-workflow: + # .... + environment: + groups: + # ... + vars: + JAVA_TOOL_OPTIONS: "-Xmx5g" +{{< /highlight >}} +- if using Workflow Editor - add `JAVA_TOOL_OPTIONS` with the value `-Xmx5g` under the Environment Variables section + +2. Upgrading to the latest version of Gradle in the `gradle-wrapper.properties` file and the Android Gradle plugin in the `android/build.gradle` file to the latest version could help fix the issue. You can refer to the Official Documentation from Android Developer guides to learn more about the latest compatible version [here](https://developer.android.com/studio/releases/gradle-plugin#updating-gradle). +3. Set the maximum heap size by adding **-Dorg.gradle.jvmargs="-Xmx4096m"** to the build command or you can add the following line in **android/gradlew**: ``` exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain -Dorg.gradle.jvmargs="-Xmx4096m" "$@"