Android: Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded

#1

Works in local, but I get this error on bitrise.io:

Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
2 errors; aborting
:app:transformClassesWithDexForDevDebug FAILED
0 Likes

#2

You’re out of memory (RAM)

This can usually be solved by setting a couple of params for JVM/Gradle to restrict RAM usage: http://devcenter.bitrise.io/android/android-tips-and-tricks/#memory-ram-limit

If the env vars would not help, a user reported an alternative config option:

The build is successful when l add these lines to my build.gradle file:

dexOptions {
javaMaxHeapSize "8g"
}

Alternatively we also provide virtual machines with double the RAM, but that costs double the standard price.

Let me know if you’d have any questions, and Happy Building! :slight_smile:

0 Likes

#3

I wanna add some more info, based on my own issue with gradle (proguard, dex tasks):

I have increased heap memory in gradle.properties, but it didn’t get respected.
My gradle is run in --no-daemon mode, so it respects the env options for JVM.

:point_right:Fix for me was setting this env JAVA_OPTS=-Xmx1024m -Xms256m.

:warning:NEW LINK to Bitrise docs: Memory settings
:warning:Do also note the different env name in docs: JAVA_OPTIONS vs mine JAVA_OPTS. For me the first didn’t work.
:warning:Gradle 5+ decreased default heap to 512MB from 1GB

More information about Gradle and memory settings can be found here: https://docs.gradle.org/current/userguide/build_environment.html#sec:configuring_jvm_memory
Do take a note about differences between build and client.

2 Likes