android
memory_error
ai_generated
true
java.lang.OutOfMemoryError: GC overhead limit exceeded during Gradle build
ID: android/gradle-oom
88%Fix Rate
90%Confidence
3Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 8 | active | — | — | — |
Root Cause
Gradle build runs out of memory. Project too large, too many modules, or JVM heap too small.
genericWorkarounds
-
90% success Increase Gradle JVM heap to reasonable size (4-8GB)
In gradle.properties: org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=512m
Sources: https://developer.android.com/build/
-
85% success Enable Gradle configuration cache to reduce memory per build
org.gradle.configuration-cache=true # in gradle.properties
-
78% success Use modularization to reduce per-module build scope
Dead Ends
Common approaches that don't work:
-
Set org.gradle.jvmargs=-Xmx16g as first attempt
60% fail
Excessive heap hides the real problem (inefficient build) and slows down GC pauses
-
Disable Gradle daemon to reduce memory usage
72% fail
Daemon keeps JVM warm for faster builds. Disabling it makes every build slower.