Cannot allocate memory during Gradle build of React-Native App

123 views Asked by At

I'm a complete newbie in this field. I just downloaded Android Studio and ran the steps from the React-Native website to set up my environment https://reactnative.dev/docs/environment-setup.

When running:

npm start and then a for android, I get the following gradle build error:

* What went wrong:
Execution failed for task ':app:stripDebugDebugSymbols'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.StripDebugSymbolsDelegate
   > There were multiple failures while executing work items
      > A failure occurred while executing com.android.build.gradle.internal.tasks.StripDebugSymbolsRunnable
         > /mnt/d/code/socrates/android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/libcrypto.so -> /mnt/d/code/socrates/android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libcrypto.so: Cannot allocate memory
      > A failure occurred while executing com.android.build.gradle.internal.tasks.StripDebugSymbolsRunnable
         > /mnt/d/code/socrates/android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/libevent_core-2.1.so -> /mnt/d/code/socrates/android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libevent_core-2.1.so: Cannot allocate memory
      > A failure occurred while executing com.android.build.gradle.internal.tasks.StripDebugSymbolsRunnable
         > /mnt/d/code/socrates/android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/libevent_extra-2.1.so -> /mnt/d/code/socrates/android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libevent_extra-2.1.so: Cannot allocate memory
      > A failure occurred while executing com.android.build.gradle.internal.tasks.StripDebugSymbolsRunnable
         > /mnt/d/code/socrates/android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/libfabricjni.so -> /mnt/d/code/socrates/android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libfabricjni.so: Cannot allocate memory
      > A failure occurred while executing com.android.build.gradle.internal.tasks.StripDebugSymbolsRunnable
         > /mnt/d/code/socrates/android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/libfbjni.so -> /mnt/d/code/socrates/android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libfbjni.so: Cannot allocate memory
      > A failure occurred while executing com.android.build.gradle.internal.tasks.StripDebugSymbolsRunnable
         > /mnt/d/code/socrates/android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/libfolly_runtime.so -> /mnt/d/code/socrates/android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libfolly_runtime.so: Cannot allocate memory
      > A failure occurred while executing com.android.build.gradle.internal.tasks.StripDebugSymbolsRunnable
         > /mnt/d/code/socrates/android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/libglog.so -> /mnt/d/code/socrates/android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libglog.so: Cannot allocate memory
      > A failure occurred while executing com.android.build.gradle.internal.tasks.StripDebugSymbolsRunnable
         > /mnt/d/code/socrates/android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/libglog_init.so -> /mnt/d/code/socrates/android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libglog_init.so: Cannot allocate memory
      > A failure occurred while executing com.android.build.gradle.internal.tasks.StripDebugSymbolsRunnable
         > /mnt/d/code/socrates/android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/libhermesinstancejni.so -> /mnt/d/code/socrates/android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libhermesinstancejni.so: Cannot allocate memory
      > A failure occurred while executing com.android.build.gradle.internal.tasks.StripDebugSymbolsRunnable
         > /mnt/d/code/socrates/android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/libimagepipeline.so -> /mnt/d/code/socrates/android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libimagepipeline.so: Cannot allocate memory
      > A failure occurred while executing com.android.build.gradle.internal.tasks.StripDebugSymbolsRunnable
         > /mnt/d/code/socrates/android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/libjscinstance.so -> /mnt/d/code/socrates/android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libjscinstance.so: Cannot allocate memory
      > A failure occurred while executing com.android.build.gradle.internal.tasks.StripDebugSymbolsRunnable
         > /mnt/d/code/socrates/android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/libjserrorhandler.so -> /mnt/d/code/socrates/android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libjserrorhandler.so: Cannot allocate memory
      > A failure occurred while executing com.android.build.gradle.internal.tasks.StripDebugSymbolsRunnable
         > /mnt/d/code/socrates/android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/libjsijniprofiler.so -> /mnt/d/code/socrates/android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libjsijniprofiler.so: Cannot allocate memory
      > A failure occurred while executing com.android.build.gradle.internal.tasks.StripDebugSymbolsRunnable
         > /mnt/d/code/socrates/android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/libjsinspector.so -> /mnt/d/code/socrates/android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libjsinspector.so: Cannot allocate memory
      > A failure occurred while executing com.android.build.gradle.internal.tasks.StripDebugSymbolsRunnable
         > /mnt/d/code/socrates/android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/libmapbufferjni.so -> /mnt/d/code/socrates/android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libmapbufferjni.so: Cannot allocate memory
      > A failure occurred while executing com.android.build.gradle.internal.tasks.StripDebugSymbolsRunnable
         > /mnt/d/code/socrates/android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/libnative-filters.so -> /mnt/d/code/socrates/android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libnative-filters.so: Cannot allocate memory
      > A failure occurred while executing com.android.build.gradle.internal.tasks.StripDebugSymbolsRunnable
         > /mnt/d/code/socrates/android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/libreact_codegen_rncore.so -> /mnt/d/code/socrates/android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreact_codegen_rncore.so: Cannot allocate memory
      > A failure occurred while executing com.android.build.gradle.internal.tasks.StripDebugSymbolsRunnable
         > /mnt/d/code/socrates/android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/libreact_config.so -> /mnt/d/code/socrates/android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreact_config.so: Cannot allocate memory
      > A failure occurred while executing com.android.build.gradle.internal.tasks.StripDebugSymbolsRunnable
         > /mnt/d/code/socrates/android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/libreact_newarchdefaults.so -> /mnt/d/code/socrates/android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreact_newarchdefaults.so: Cannot allocate memory
      > A failure occurred while executing com.android.build.gradle.internal.tasks.StripDebugSymbolsRunnable
         > /mnt/d/code/socrates/android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/libreact_render_animations.so -> /mnt/d/code/socrates/android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreact_render_animations.so: Cannot allocate memory
      > A failure occurred while executing com.android.build.gradle.internal.tasks.StripDebugSymbolsRunnable
         > /mnt/d/code/socrates/android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/libreact_render_attributedstring.so -> /mnt/d/code/socrates/android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreact_render_attributedstring.so: Cannot allocate memory
      > A failure occurred while executing com.android.build.gradle.internal.tasks.StripDebugSymbolsRunnable
         > /mnt/d/code/socrates/android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/libreact_render_core.so -> /mnt/d/code/socrates/android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreact_render_core.so: Cannot allocate memory

Haven't been able to find a solution so far. Any ideas?

I tried increasing memory org.gradle.jvmargs=-Xmx4608m -XX:MaxMetaspaceSize=512m, and I tried setting multiDexEnabled true but no avail

0

There are 0 answers