Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not download react-android-0.71.4-debug.aar

I am trying to install and run react-native app on an android emulator in my windows device but i keep getting this error

FAILURE: Build completed with 2 failures.

1: Task 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.71.4-debug.aar (com.facebook.react:react-android:0.71.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}. > Could not download react-android-0.71.4-debug.aar (com.facebook.react:react-android:0.71.4) > Could not get resource 'https://repo.maven.apache.org/maven2/com/facebook/react/react-android/0.71.4/react-android-0.71.4-debug.aar'. > Could not GET 'https://repo.maven.apache.org/maven2/com/facebook/react/react-android/0.71.4/react-android-0.71.4-debug.aar'. > This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server (repo.maven.apache.org)

  • 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. ==============================================================================

2: Task failed with an exception.

  • What went wrong: java.lang.StackOverflowError (no error message)

  • 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 2m 50s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build completed with 2 failures.

1: Task 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.71.4-debug.aar (com.facebook.react:react-android:0.71.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}. > Could not download react-android-0.71.4-debug.aar (com.facebook.react:react-android:0.71.4) > Could not get resource 'https://repo.maven.apache.org/maven2/com/facebook/react/react-android/0.71.4/react-android-0.71.4-debug.aar'. > Could not GET 'https://repo.maven.apache.org/maven2/com/facebook/react/react-android/0.71.4/react-android-0.71.4-debug.aar'. > This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server (repo.maven.apache.org)

  • 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. ==============================================================================

2: Task failed with an exception.

  • What went wrong: java.lang.StackOverflowError (no error message)

  • 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 2m 50s

at makeError (C:\Users\PHANZ\Desktop\project\Kekeno\node_modules\execa\index.js:174:9)
at C:\Users\PHANZ\Desktop\project\Kekeno\node_modules\execa\index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (C:\Users\PHANZ\Desktop\project\Kekeno\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:82:7)
at async Command.handleAction (C:\Users\PHANZ\Desktop\project\Kekeno\node_modules\@react-native-community\cli\build\index.js:108:9)

info Run CLI with --verbose flag for more details.

like image 420
Nbaron Jekeko Avatar asked Aug 12 '26 19:08

Nbaron Jekeko


2 Answers

Based on your questions you can do 3 things here:

  1. You can try clearing the Gradle cache by running the following command in the terminal:
./gradlew cleanBuildCache
  1. If clearing the Gradle cache does not work, try updating Gradle to the latest version.
./gradlew wrapper --gradle-version 8.0.2
  1. You can try increasing the stack size by adding the following line to your gradle.properties file:
org.gradle.jvmargs=-Xss512m

This will increase the stack size to 512MB.

Let me know if it works now. I also would make sure your internet connection is stable.

like image 181
Joseph Shenouda Avatar answered Aug 15 '26 08:08

Joseph Shenouda


Having a similar issue. What I noticed, in the node_modules/react-native/android/ there is no aar and just a readme file saying this:

Starting from React Native 0.71, we're not shipping the /android folder inside the React Native NPM package anymore due to sizing constraints on NPM. The Android artifacts are distributed via Maven Central. You can read more about it in this RFC: https://github.com/react-native-community/discussions-and-proposals/pull/508

If you're a library author and you're manipulating the React Native .aar files, to extract headers, extract .so files or do anything with it, you're probably doing something wrong. React Native 0.71 ships with all the necessary logic to let you consume it transparently by just using:

implementation("com.facebook.react:react-android") 
// or to keep
backward compatibility with older versions of React Native:
implementation("com.facebook.react:react-native:+") 

You should consider refactoring your library code not to unzip/manipulate the React Native .aar files.

This README.md file is kept in this folder as some libraries are checking the existence of the /android folder and failing user builds if the folder is missing.

So I would try to add the implementation dependency and remove the task

like image 41
Maxxxx Avatar answered Aug 15 '26 10:08

Maxxxx



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!