I am facing this Error while running my react native project on android at windows. Here are details of the error in the CLI
Task :app:checkDebugAarMetadata FAILED 19 actionable tasks: 2 executed, 17 up-to-date
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-native-0.71.0-rc.0-debug.aar (com.facebook.react:react-native:0.71.0-rc.0) 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\hayat.gradle\caches\modules-2\files-2.1\com.facebook.react\react-native\0.71.0-rc.0\7a7f5a0af6ebd8eb94f7e5f7495e9d9684b4f543\react-native-0.71.0-rc.0-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.
Get more help at https://help.gradle.org
BUILD FAILED in 30s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
I have tried two solutions One upgrading SDK version
buildToolsVersion = "30.0.3"
minSdkVersion = 29
compileSdkVersion = 31
targetSdkVersion = 31
supportLibVersion = "29.0.0"
And second by adding this code in build.gradle file
android {
defaultConfig {
configurations.all {
resolutionStrategy { force 'androidx.work:work-runtime:2.6.0' }
}
}
}