Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.75.x/0.76.x] Failing to build on Windows - Could not move temporary workspace - Error resolving plugin [id: 'com.facebook.react.settings'] - java.io.UncheckedIOException #46210

Closed
adhikarisandil32 opened this issue Aug 20, 2024 · 112 comments
Labels
Needs: React Native Team Attention Platform: Windows Building on Windows. Resolution: Fixed A PR that fixes this issue has been merged.

Comments

@adhikarisandil32
Copy link

adhikarisandil32 commented Aug 20, 2024

IMPORTANT: The latest official update on this issue is here #46210 (comment)

FAILURE: Build failed with an exception.

* Where:
Settings file 'F:\tutorial-practice\frontend-development\react-native\native-cli-todo-app-2\android\settings.gradle' line: 2

* What went wrong:
Error resolving plugin [id: 'com.facebook.react.settings']
> java.io.UncheckedIOException: Could not move temporary workspace (F:\tutorial-practice\frontend-development\react-native\native-cli-todo-app-2\android\.gradle\8.8\dependencies-accessors\569c8b261a8a714d7731d5f568e0e5c05babae10-29ae1a11-17a6-474d-825c-7114fe1603d2) to immutable location (F:\tutorial-practice\frontend-development\react-native\native-cli-todo-app-2\android\.gradle\8.8\dependencies-accessors\569c8b261a8a714d7731d5f568e0e5c05babae10)

This is the full error. The command I've used to create the project is npx @react-native-community/cli init TodoApp2 --directory ./native-cli-todo-app-2. The projects is created successfully. After I run npm run start and hit a, for android, build fails showing the above error. Another project which uses 0.74.3 is working just fine. Creating new project automatically uses 0.75.2 version which is fine, but it shows the error while building because of which development server doesn't start.
Screenshot 2024-08-21 010605

@rghanks

This comment was marked as duplicate.

@adhikarisandil32
Copy link
Author

facing same issue

@rghanks

I've found a trick though. hit npm run android, let it do its job all the way. Now exit the terminal, clear the console and then again hit npm run start. Work for me.

@parmarraj999
Copy link

facing same issue

@rghanks

I've found a trick though. hit npm run android, let it do its job all the way. Now exit the terminal, clear the console and then again hit npm run start. Work for me.

this is working for me also

@lq9958
Copy link

lq9958 commented Aug 22, 2024

+1 ,I tried switching different gradle versions but it didn't work.

@MaiThanhNam141

This comment was marked as duplicate.

@tecnologiacd2
Copy link

Roll back versions: 0.75.2 to 0.75.1

@react-native/gradle-plugin
react-native
@react-native/babel-preset
@react-native/eslint-config
@react-native/metro-config
@react-native/typescript-config

*Don't run npm/yarn fix, it updates without permission and becomes incompatible

@ericmtzmtz
Copy link

facing same issue

@rghanks

I've found a trick though. hit npm run android, let it do its job all the way. Now exit the terminal, clear the console and then again hit npm run start. Work for me.

Don't work for me 😭

@KaziReazulislam1999

This comment was marked as off-topic.

@Agent009
Copy link

None of the proposed solutions seem to be working.

  • Changed Java version from 17 to 21
  • Downgraded from gradle 8.8 to 8.6/8.5
  • Downgraded from RN 0.75.2 to 0.75.1
  • Cleared cache, deleted .gradle and build directories.

It always gets stuck at the same spot with the same error.

@adhikarisandil32
Copy link
Author

adhikarisandil32 commented Aug 25, 2024

@Agent009 may be downgrade a version not on the same app but create a completely new project using npx @react-native-community/cli init ProjectName --version=0.74. just give it a try

@Agent009
Copy link

Downgrading to RN 0.74.5 and Gradle 8.5 solves the issue.
Wonder how the new release has been working for other folks. May just be an issue with those with simulated devices running on emulators?

@adhikarisandil32
Copy link
Author

Downgrading to RN 0.74.5 and Gradle 8.5 solves the issue. Wonder how the new release has been working for other folks. May just be an issue with those with simulated devices running on emulators?

@Agent009 I use it on real actual device and I face the same issue. I don't know. Nobody seems to be working on it. And I don't know react native enough to work on it. I don't know how to direct contributers to this issue.

@robhogan robhogan transferred this issue from facebook/metro Aug 26, 2024
@react-native-bot
Copy link
Collaborator

⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

@react-native-bot react-native-bot added Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels Aug 26, 2024
@react-native-bot
Copy link
Collaborator

⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:

@robhogan
Copy link
Contributor

robhogan commented Aug 26, 2024

Transferred to facebook/react-native as this isn’t Metro related and I can’t help directly. It looks like it might be specific to the community CLI but clearly it’s affecting quite a few people. CC @cortinico

@Ibeenoch

This comment was marked as off-topic.

@raahimkhan

This comment was marked as off-topic.

@raahimkhan

This comment was marked as off-topic.

@ralppppy
Copy link

This works for me #46046 (comment)

@GangulyYadavCDAT
Copy link

i was facing the same issue what i just did to solve is
cd android
then
gradlew clean or ./gradlew clean
then
gradlew build or ./gradlew build
whatever works for you give it a try
then run your project

@cortinico cortinico changed the title Error resolving plugin [id: 'com.facebook.react.settings'] Error resolving plugin [id: 'com.facebook.react.settings'] - java.io.UncheckedIOException: Could not move temporary workspace Aug 28, 2024
@cortinico cortinico added the Platform: Windows Building on Windows. label Aug 28, 2024
@cortinico cortinico changed the title Error resolving plugin [id: 'com.facebook.react.settings'] - java.io.UncheckedIOException: Could not move temporary workspace [0.75.x] Failing to build on Windows - Error resolving plugin [id: 'com.facebook.react.settings'] - java.io.UncheckedIOException: Could not move temporary workspace Aug 28, 2024
@cortinico
Copy link
Contributor

cortinico commented Aug 28, 2024

Due to a various of random comments, it's extremely hard for us to understand what happened here.

Please refrain from commenting "same issue" as that creates only unnecessary noise

As far as I understood:

  1. The issue is happening only on Windows
  2. The issue is happening only on React Native 0.75.x

If that is NOT the case for you -> Open another issue and do not comment here.

I've sharing some steps that could (hopefully help till we try to identify what's the issue):

  1. Make sure you don't have a version of @react-native/gradle-plugin specified in your package.json. If you have it, please remove it.
  2. Check with yarn why @react-native/gradle-plugin that the output is:
$ yarn why @react-native/gradle-plugin
├─ react-native@npm:0.75.1
│  └─ @react-native/gradle-plugin@npm:0.75.1 (via npm:0.75.1)
│
└─ react-native@npm:0.75.1 [473c9]
   └─ @react-native/gradle-plugin@npm:0.75.1 (via npm:0.75.1)
  1. Kill all the Gradle daemons with cd android && ./gradlew --stop
  2. Remove the .gradle folder with cd android && rm -rf .gradle/ && rm -rf ~/.gradle/caches
  3. Attemp to downgrade to Gradle 8.6 by changing this file android/gradle/wrapper/gradle-wrapper.properties:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
  1. Attempt to upgrade to Gradle 8.10 by editing the same file.

Please report back if this solves the issue @Agent009

@cortinico
Copy link
Contributor

(Related to gradle/gradle#27844)

facebook-github-bot pushed a commit that referenced this issue Dec 2, 2024
Summary:
Pull Request resolved: #48026

This should mitigate this particular issue we're seeing on Windows:
- #46210

Changelog:
[Android] [Changed] - Gradle to 8.11.1

Reviewed By: javache

Differential Revision: D66600321

fbshipit-source-id: d58437485222e189d90bcf4d6b41ca956449ed22
@cortinico
Copy link
Contributor

cortinico commented Dec 3, 2024

Just a heads up that Gradle 8.11.1 got released which should mitigate this issue.

If you're having this problem could you try to upgrade Gradle version with:

cd android
./gradlew wrapper --gradle-version=8.11.1 --distribution-type=all
./gradlew clean

After that, can you report back if the issue persists?

@nithronium
Copy link

Just a heads up that Gradle 8.11.1 got released which should mitigate this issue.

If you're having this problem could you try to upgrade Gradle version with:

cd android
./gradlew wrapper --gradle-version=8.11.1 --distribution-type=all
./gradlew clean

After that, can you report back if the issue persists?

After spending many hours on debugging a lot of different stuff, I can confirm that this solved the problem for me. Thank you @cortinico

@vedantb2
Copy link

I just restarted vscode and it seems to have fixed it

cipolleschi pushed a commit that referenced this issue Dec 16, 2024
Summary:
Pull Request resolved: #48026

This should mitigate this particular issue we're seeing on Windows:
- #46210

Changelog:
[Android] [Changed] - Gradle to 8.11.1

Reviewed By: javache

Differential Revision: D66600321

fbshipit-source-id: d58437485222e189d90bcf4d6b41ca956449ed22
@nhatduong-agilityio
Copy link

I was upgrading from 0.74.2 to 0.75.2 and got the same error on Android, here is what worked for me (using gradle-8.8-all.zip):

  • remove node_modules, yarn.lock and android/.gradle
  • yarn install
  • cd android && ./gradlew --stop
  • ./gradlew clean
  • npx react-native start --reset-cache in the root of the project

Hope this will be helpful

Does anyone have problems running ./gradlew clean?
Screenshot_84

@cipolleschi
Copy link
Contributor

@nhatduong-agilityio have you run yarn install? the error message says that the path <your_app>\node_modules\@react-native\gradle-plugin does not exists. This usually happens because you have not run yarn install and therefore there is no node_modules folder materialized

@nhatduong-agilityio
Copy link

@cipolleschi I have handled the problem. I install more gradle-plugin then delete package lock, delete node_module, then yarn install again, and run command ./gradlew clean before run react-native android. Thanks

@azmatalism
Copy link

facing same issue

@rghanks

I've found a trick though. hit npm run android, let it do its job all the way. Now exit the terminal, clear the console and then again hit npm run start. Work for me.

Work for me

@jayesh-vyas
Copy link

This error occurred when i was using npx react-native run-android but it worked when i used npm run android

@KHadham
Copy link

KHadham commented Dec 28, 2024

the weird thing is ,after all unworking solution out there
restarting my machine solve this problem

android/settings.gradle' line: 4

* What went wrong:
Error resolving plugin [id: 'com.facebook.react.settings']
> Could not read workspace metadata from

@meshboy88
Copy link

I Found a solution. I'm using RN CLI: 0.76.5

  1. Open the folder you want your app at VS Code
  2. create app with: npx @react-native-community/cli init nameofyourapp
  3. Run your emulator. Example: emulator -avd Pixel_4a_API_35
  4. First build MUST be with android and not with start. Example: yarn android.

This is working consistently for me.

@DewantiV
Copy link

DewantiV commented Jan 3, 2025

just delete node_modules folder = > npm install => npm start -- --reset-cache => npm run android => done

cipolleschi pushed a commit that referenced this issue Jan 8, 2025
Summary:
Pull Request resolved: #48026

This should mitigate this particular issue we're seeing on Windows:
- #46210

Changelog:
[Android] [Changed] - Gradle to 8.11.1

Reviewed By: javache

Differential Revision: D66600321

fbshipit-source-id: d58437485222e189d90bcf4d6b41ca956449ed22
@Syfer0
Copy link

Syfer0 commented Jan 12, 2025

just delete node_modules folder = > npm install => npm start -- --reset-cache => npm run android => done

this works for me Thanks

@cortinico
Copy link
Contributor

Closing as React Native 0.76.6 was released which contains a bump of Gradle to 8.11.1 which solves this issue for good.

@cortinico cortinico added the Resolution: Fixed A PR that fixes this issue has been merged. label Jan 13, 2025
@amintf42
Copy link

just delete node_modules folder = > npm install => npm start -- --reset-cache => npm run android => done

I did this but it still gives me this error.

  • What went wrong:
    A problem occurred configuring root project 'android'.

Could not resolve all artifacts for configuration ':classpath'.
Could not find com.facebook.react:react-native-gradle-plugin:0.76.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/facebook/react/react-native-gradle-plugin/0.76.6/react-native-gradle-plugin-0.76.6.pom
- https://repo.maven.apache.org/maven2/com/facebook/react/react-native-gradle-plugin/0.76.6/react-native-gradle-plugin-0.76.6.pom
- https://www.jitpack.io/com/facebook/react/react-native-gradle-plugin/0.76.6/react-native-gradle-plugin-0.76.6.pom
Required by:
root project :

@codewitharun
Copy link

I installed 0.76.6 today but the issue is still there

@cwoolum
Copy link

cwoolum commented Jan 20, 2025

Updating to 0.76.6 got me to Gradle 8.10.2 which now makes ./gradlew clean work. That made it so I was able to run an android build finally. I wasn't able to successfully run clean before.

@ikarofelix
Copy link

I have 3 different projects with expo and I've been having a lot of similar problems lately, I've used 0.76.6, 0.75.2, 0.74... I've tried so many things and I'd would always have some problem, either this one, related to cache, sometimes it would work, the other day with the same config it would not.

I've managed to get it working by taking a look at /android/gradle/gradle-wrapper.properties, on the variable distributionUrl you have the gradle version. Go to https://docs.gradle.org/current/userguide/compatibility.html and take a look at the compatible java version, mine was 8.10.2, so I needed java 23, which I installed:
❯ java --version
openjdk 23 2024-09-17
OpenJDK Runtime Environment (build 23)
OpenJDK 64-Bit Server VM (build 23, mixed mode, sharing)

Now its working with just yarn android, without having to gradlew clean or even assemble as I have been doing a couple days ago. Don't forget to restart the terminal once you change the java version.

This could work for someone else, because yesterday I tried the same thing and it did not work for some strange reason. The version of react-native that people are saying 0.76.6 that has an update, did not work for me, so just give this a shot.

My dependencies versions, I'm also using yarn btw, not npm:

"@expo/config-plugins": "^9.0.14",
"@expo/prebuild-config": "^8.0.25",
"expo": "^52.0.17",
"expo-dev-client": "~5.0.5",
"react-native": "0.76.5",

@uralaltan
Copy link

For me moving the entire project to D:\ fixed it

@vweb69
Copy link

vweb69 commented Feb 3, 2025

I have tried your provided solutions but these are not working in my condition isn't working. could you please help me

here is settings. gradle
Image

here is gradle.wrapper.properties
Image

here is my package.json

Image

@yamithell
Copy link

My build gave out many different errors on an empty project
It worked for me:

jdk-20
react-native 0.76.6
gradle 8.9

@NicholasKoldys
Copy link

For others experiencing the issue for fresh-latest builds, check the gradle wrapper version under 'distributionUrl' in "./_MyApp/android/gradle/wrapper/gradle-wrapper.properties".

Here my* gradle version was 8.10.2 via fresh RN0.77 install, (this was not working for me, through npm install/start/run)
for RN0.77 it should be 8.11.1 noted above (#46210 (comment)).

Also for noteworthy: pnpm run will give the same error with the updated gradlew, so using yarn at the moment.

@Antony-Jia
Copy link

Antony-Jia commented Feb 6, 2025

just delete node_modules folder = > npm install => npm start -- --reset-cache => npm run android => done

I try all the ways about "com.facebook.react.settings" and think this is the only way to solve it.

@Prafullsingh975
Copy link

I was also facing the same problem. My react-native version was 0.75.13. I upgraded it to react-native version 0.77.0 and resolved my issue.

Steps:

  • go to https://react-native-community.github.io/upgrade-helper/
    Please make the changes that are mentioned.
  • restart the pc
  • go to C:\Users\User_Name.gradle
  • delete caches and wrapper folder
  • delete node_module and package-log.json
  • do npm i
  • delete debug build
  • run npx react-native run-android

and my problem was solved

@SorenHK
Copy link

SorenHK commented Feb 18, 2025

I've managed to get it working by taking a look at /android/gradle/gradle-wrapper.properties, on the variable distributionUrl you have the gradle version. Go to https://docs.gradle.org/current/userguide/compatibility.html and take a look at the compatible java version, mine was 8.10.2, so I needed java 23, which I installed: ❯ java --version openjdk 23 2024-09-17 OpenJDK Runtime Environment (build 23) OpenJDK 64-Bit Server VM (build 23, mixed mode, sharing)

Thank you @ikarofelix ! The solution for me ended up being just updating to JDK 23 like you mentioned. I am on Gradle 8.10.2 and React Native 0.74.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: React Native Team Attention Platform: Windows Building on Windows. Resolution: Fixed A PR that fixes this issue has been merged.
Projects
None yet
Development

No branches or pull requests