| 1 | const { withGradleProperties } = require("expo/config-plugins"); |
| 2 | |
| 3 | // The Expo template's 2GB heap is too small for D8 dex merging in this app, |
| 4 | // causing OutOfMemoryError in :app:mergeExtDexDebug. |
| 5 | const JVM_ARGS = "-Xmx4096m -XX:MaxMetaspaceSize=1024m"; |
| 6 | |
| 7 | module.exports = function withAndroidGradleHeap(config) { |
| 8 | return withGradleProperties(config, (nextConfig) => { |
| 9 | const properties = nextConfig.modResults.filter( |
| 10 | (item) => !(item.type === "property" && item.key === "org.gradle.jvmargs"), |
| 11 | ); |
| 12 | |
| 13 | properties.push({ |
| 14 | type: "property", |
| 15 | key: "org.gradle.jvmargs", |
| 16 | value: JVM_ARGS, |
| 17 | }); |
| 18 | |
| 19 | nextConfig.modResults = properties; |
| 20 | return nextConfig; |
| 21 | }); |
| 22 | }; |