Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React native or flutter apps stop running or building

I have all the necessary things installed, still running into this error. I have tried all the other Stack Overflow answers, increasing the heap size, and modifying the build.gradle files etc, still no results.

Picked up _JAVA_OPTIONS: -Xmx512M

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Failed to transform react-android-0.72.3-debug.aar (com.facebook.react:react-android:0.72.3) to match attributes {artifactType=android-aar-metadata, com.android.build.api.attributes.BuildTypeAttr=debug, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for JetifyTransform: C:\Users\prave\.gradle\caches\modules-2\files-2.1\com.facebook.react\react-android\0.72.3\753dcb10579a06570819a980133bb5042d82a6a5\react-android-0.72.3-debug.aar.
         > Java heap space
   > Failed to transform hermes-android-0.72.3-debug.aar (com.facebook.react:hermes-android:0.72.3) to match attributes {artifactType=android-aar-metadata, com.android.build.api.attributes.BuildTypeAttr=debug, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for JetifyTransform: C:\Users\prave\.gradle\caches\modules-2\files-2.1\com.facebook.react\hermes-android\0.72.3\f89c2cda86da7a97ffd78484839d880f8eccd3c9\hermes-android-0.72.3-debug.aar.
         > Java heap space

* 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.

For some reason whenever I run a React Native or build a Flutter app, I always run into the error. It used to work before, but at some point, it all stopped working

like image 702
webstar Avatar asked May 22 '26 17:05

webstar


1 Answers

I ran into a similar error with my Expo based react-native app. Expo 49, RN 0.72.

I solved it by changing the gradle jvm args - I increased the maximum memory to 4048m instead of 2048m:

org.gradle.jvmargs=-Xmx4048m -XX:MaxMetaspaceSize=512m

in android/gradle.properties

like image 106
Niclas Avatar answered May 26 '26 03:05

Niclas