Skip to content

Commit

Permalink
java heap error workaround update (#2859)
Browse files Browse the repository at this point in the history
* java heap error workaround update

* added code example

* add sentence for WFE
  • Loading branch information
dtrdic authored Dec 2, 2024
1 parent 01d3274 commit d0d1b09
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions content/troubleshooting/common-android-issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" "$@"
Expand Down

0 comments on commit d0d1b09

Please sign in to comment.