I am trying to run a React Native project on Android, but the build fails with a Gradle error.
Error:
A problem occurred configuring root project 'Awesome Project'.
BUILD FAILED in 2m 50serror Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'AwesomeProject'. > A build operation failed. Could not move temporary workspace (C:\Users\TGS-011\.gradle\caches\9.0.0\transforms\43e4f82d41dd2c8e6a20286f31eb996c-38c061c2-e00b-46cd-b46d-1c0880344f88) to immutable location (C:\Users\TGS-011\.gradle\caches\9.0.0\transforms\43e4f82d41dd2c8e6a20286f31eb996c) > Could not move temporary workspace (C:\Users\TGS-011\.gradle\caches\9.0.0\transforms\43e4f82d41dd2c8e6a20286f31eb996c-38c061c2-e00b-46cd-b46d-1c0880344f88) to immutable location (C:\Users\TGS-011\.gradle\caches\9.0.0\transforms\43e4f82d41dd2c8e6a20286f31eb996c) * 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 generate a Build Scan (Powered by Develocity). > Get more help at https://help.gradle.org. BUILD FAILED in 2m 50s.
What I tried:
1.Deleted .gradle cache
2.Run gradlew clean
3.Reinstalled NodeJs, JDK, Android Studio, React CLI
4.Restarted system
5.Run terminal as administrator.
6.Run Admin profile.
I run npx react-native doctor my results look like
Common
✓ Node.js - Required to execute JavaScript code
✓ npm - Required to install NPM dependencies
● Metro - Metro Bundler is not running
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_HOME - Environment variable that points to your Android SDK installation
✓ Gradlew - Build tool required for Android builds
✓ Android SDK - Required for building and installing your app on Android
Can someone help me understand why this is happening and how to fix it?