What went wrong?

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.4-debug.aar (com.facebook.react:react-android:0.72.4) 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\Andrey\.gradle\caches\modules-2\files-2.1\com.facebook.react\react-android\0.72.4\908144bc260f04956a10fa2f6bd9583c6e963ba5\react-android-0.72.4-debug.aar. 
         > Java heap space
   > Failed to transform hermes-android-0.72.4-debug.aar (com.facebook.react:hermes-android:0.72.4) 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\Andrey\.gradle\caches\modules-2\files-2.1\com.facebook.react\hermes-android\0.72.4\e60ee8dfe14563da1f0df1616c1bbd6cb2745548\hermes-android-0.72.4-debug.aar.
         > Java heap space

If you would execute with --stacktrace or --scan as advised in the error message, you would see the actual exception which should be OutOfMemoryError judging by the message “Java heap space”. So it seems your build needs more heap space to run.

So you most probably need to configure org.gradle.jvmargs in your gradle.properties so that the Gradle daemon has more heap available than the default 512k, as documented at Build Environment.