skip to Main Content

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:UsersBenTo.gradlecachesmodules-2files-2.1com.facebook.reactreact-android.72.62e2db118c9084b05c1a5d6079148bc983668f372react-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.

2

Answers


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

    1. run ./gradlew clean and then ./gradlew assembleDebug in the android folder of your project to clean gradle cache
    2. Now run ./gradlew build to build android folder and then if it is successful you should be able to run the project.
    Login or Signup to reply.
  2. Open your project on Android studio And follow these steps

    Click Tools on Android Studio nav bar

    Click SDK Manager

    Go on Languages and Frameworks and click Android SDK

    Then select Android API 34 and Android 13.0 or you can check that what’s your mobile OS version and select also that one.

    And click Apply it will install that SDK for you.

    After this you show clean your gradle by using ./gradlew clean command and then you can run your project it definately run your project on your mobile.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search