Skip to content

Android build failed: Could not move temporary workspace in Gradle cache #56171

@deepak-0421

Description

@deepak-0421

Description

Android build failed: Could not move temporary workspace in Gradle cache

Error:
A problem occurred configuring root project 'AwesomeProject'.

Could not move temporary workspace
(C:\Users\TGS-011\.gradle\caches\9.0.0\transforms\...)
to immutable location

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

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

Steps to reproduce

  1. Run npm run android
  2. Wait for build
  3. Build fails with Gradle error

React Native Version

0.84.1

Affected Platforms

Runtime - Android

Output of npx @react-native-community/cli info

System:
  OS: Windows 11 10.0.26200
  CPU: (12) x64 12th Gen Intel(R) Core(TM) i5-1235U
  Memory: 1.42 GB / 15.69 GB
Binaries:
  Node:
    version: 24.14.0
    path: D:\Deepak014\node.EXE
  Yarn: Not Found
  npm:
    version: 11.9.0
    path: D:\Deepak014\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK:
    API Levels:
      - "35"
      - "36"
      - "36"
    Build Tools:
      - 36.0.0
    System Images:
      - android-35 | Intel x86_64 Atom
      - android-35 | Google APIs Intel x86_64 Atom
      - android-36.1 | Google Play Intel x86_64 Atom
    Android NDK: Not Found
  Windows SDK: Not Found
IDEs:
  Android Studio: Not Found
  Visual Studio:
    - 17.14.37012.4 (Visual Studio Community 2022)
Languages:
  Java:
    version: 17.0.18
    path: D:\Deepak14Config\JDK\microsoft-jdk-17.0.18-windows-x64\jdk-17.0.18+8\bin\javac.EXE
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli":
    installed: 20.1.0
    wanted: 20.1.0
  react:
    installed: 19.2.3
    wanted: 19.2.3
  react-native:
    installed: 0.84.1
    wanted: 0.84.1
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Stacktrace or Logs

BUILD FAILED in 2m 50s
error 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.

MANDATORY Reproducer

I am unable to provide a minimal reproducer because this issue appears to be environment-specific (Gradle cache / Windows file locking issue). However, the same error occurs even in a newly created React Native project: npx @react-native-community/cli@latest init AwesomeProject cd AwesomeProject npm run android

Screenshots and Videos

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions