Programming/React Native

[ReaceNative] Expiring Daemon because JVM heap space is exhausted

통통만두 2021. 8. 4. 05:36
반응형

ReactNative 에서 안드로이드 빌드를하려고 할때 JVM 메모리가 부족해서 빌드에 실패할 경우가 있다.

> Task :app:packageRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:packageRelease'.
> A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
   > java.lang.OutOfMemoryError (no error message)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 2m 8s
329 actionable tasks: 314 executed, 15 up-to-date
Expiring Daemon because JVM heap space is exhausted

 

이 경우에는 ./android/gradle.properties 파일에서 아래 한 줄을 추가해준다.

org.gradle.jvmargs=-Xmx4096M
반응형

그러면 정상적으로 빌드가 되는 것을 확인할 수 있다.

Starting a Gradle Daemon, 2 stopped Daemons could not be reused, use --status for details

> Configure project :react-native-firebase_admob
:react-native-firebase_admob package.json found at /Users/marsland/company/service/react-native/service/node_modules/@react-native-firebase/admob/package.json
:react-native-firebase_app package.json found at /Users/marsland/company/service/react-native/service/node_modules/@react-native-firebase/app/package.json
:react-native-firebase_admob:ads.consent using default value: 1.0.6
:react-native-firebase_admob package.json found at /Users/marsland/company/service/react-native/service/node_modules/@react-native-firebase/admob/package.json
:react-native-firebase_admob:version set from package.json: 11.5.0 (11,5,0 - 11005000)
:react-native-firebase_admob:android.compileSdk using custom value: 29
:react-native-firebase_admob:android.targetSdk using custom value: 29
:react-native-firebase_admob:android.minSdk using custom value: 21
:react-native-firebase_admob:reactNativeAndroidDir /Users/marsland/company/service/react-native/service/node_modules/react-native/android

> Configure project :react-native-firebase_app
:react-native-firebase_app package.json found at /Users/marsland/company/service/react-native/service/node_modules/@react-native-firebase/app/package.json
:react-native-firebase_app:firebase.bom using default value: 26.8.0
:react-native-firebase_app:play.play-services-auth using default value: 19.0.0
:react-native-firebase_app package.json found at /Users/marsland/company/service/react-native/service/node_modules/@react-native-firebase/app/package.json
:react-native-firebase_app:version set from package.json: 11.5.0 (11,5,0 - 11005000)
:react-native-firebase_app:android.compileSdk using custom value: 29
:react-native-firebase_app:android.targetSdk using custom value: 29
:react-native-firebase_app:android.minSdk using custom value: 21
:react-native-firebase_app:reactNativeAndroidDir /Users/marsland/company/service/react-native/service/node_modules/react-native/android

> Task :app:bundleReleaseJsAndAssets
warning: the transform cache was reset.
                    Welcome to Metro!
              Fast - Scalable - Integrated


info Writing bundle output to:, /Users/marsland/company/service/react-native/service/android/app/build/generated/assets/react/release/index.android.bundle
info Writing sourcemap output to:, /Users/marsland/company/service/react-native/service/android/app/build/generated/sourcemaps/react/release/index.android.bundle.map
info Done writing bundle output
info Done writing sourcemap output
info Copying 36 asset files
info Done copying assets

> Task :app:generateBundledResourcesHashRelease
0d20bc7a634a634e1901c70e34f63684d8aa8bda5bb4aa2e9aaa85aad73dd114

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 1m 14s
387 actionable tasks: 52 executed, 335 up-to-date
반응형