I have been getting this error when trying to run npm android build on my native react project. I have gone through the entire android setup along with updating Environment variables. The emulator works but the install fails with the following message:
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.6-debug.aar (com.facebook.react:react-android:0.72.6) 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\BenTo\.gradle\caches\modules-2\files-2.1\com.facebook.react\react-android\0.72.6\2e2db118c9084b05c1a5d6079148bc983668f372\react-android-0.72.6-debug.aar.
build.gradle as follows:
buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
ndkVersion = "23.1.7779620"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath('com.facebook.react:react-native-gradle-plugin')
}
}
I have also run react doctor, it shows the following:
Android
✓ Adb - Required to verify if the android device is attached correctly
✓ JDK - Required to compile Java code
✓ Android Studio - Required for building and installing your app on Android
✖ Android SDK - Required for building and installing your app on Android
- Versions found: N/A
- Version supported: 33.0.0
✓ ANDROID_HOME - Environment variable that points to your Android SDK installation
Errors: 1
Warnings: 0
Usage
› Press f to try to fix issues.
› Press e to try to fix errors.
› Press w to try to fix warnings.
› Press Enter to exit.
When I press e to resolve, it shows the issues was fixed and to restart. When I restart I get the same error.
Please help.
This might be the answer you are looking for React Native app not running without doing anything in the previous working code
Try checking the SDK version in your android studio settings, Click on SDK Manager, and then SDK tools, and then click on Show Package Details and check if you have ticked 33.0.0 which is required for android development and is mentioned in the development environment setup of react native as well.
Link - https://reactnative.dev/docs/environment-setup
Also few steps