react-native icon indicating copy to clipboard operation
react-native copied to clipboard

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

Open adhikarisandil32 opened this issue 1 year ago β€’ 53 comments

IMPORTANT: The latest official update on this issue is here https://github.com/facebook/react-native/issues/46210#issuecomment-2346835978

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

adhikarisandil32 avatar Aug 20 '24 19:08 adhikarisandil32

facing same issue

rghanks avatar Aug 21 '24 14:08 rghanks

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.

adhikarisandil32 avatar Aug 21 '24 16:08 adhikarisandil32

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

parmarraj999 avatar Aug 21 '24 23:08 parmarraj999

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

lq9958 avatar Aug 22 '24 00:08 lq9958

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.

That's work for me! Thanks alot!!!!😍😍😍

MaiThanhNam141 avatar Aug 22 '24 11:08 MaiThanhNam141

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

tecnologiacd2 avatar Aug 23 '24 13:08 tecnologiacd2

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 😭

ericmtzmtz avatar Aug 23 '24 22:08 ericmtzmtz

@adhikarisandil32, thanks bro , i am facing same issue and it's work for me.

KaziReazulislam1999 avatar Aug 24 '24 17:08 KaziReazulislam1999

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.

Agent009 avatar Aug 25 '24 08:08 Agent009

@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

adhikarisandil32 avatar Aug 25 '24 09:08 adhikarisandil32

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 avatar Aug 25 '24 11:08 Agent009

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.

adhikarisandil32 avatar Aug 25 '24 18:08 adhikarisandil32

:warning: Missing Reproducible Example
:information_source: 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 avatar Aug 26 '24 08:08 react-native-bot

:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:

react-native-bot avatar Aug 26 '24 08:08 react-native-bot

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

robhogan avatar Aug 26 '24 08:08 robhogan

still can't find a fix

Ibeenoch avatar Aug 26 '24 14:08 Ibeenoch

Facing same issue

raahimkhan avatar Aug 27 '24 18:08 raahimkhan

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.

I have the same versions but still getting the error.

raahimkhan avatar Aug 27 '24 19:08 raahimkhan

This works for me https://github.com/facebook/react-native/issues/46046#issuecomment-2295388352

ralppppy avatar Aug 28 '24 00:08 ralppppy

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

GangulyYadavCDAT avatar Aug 28 '24 09:08 GangulyYadavCDAT

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 avatar Aug 28 '24 12:08 cortinico

(Related to https://github.com/gradle/gradle/issues/27844)

cortinico avatar Aug 28 '24 12:08 cortinico

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

  1. yarn why @react-native/gradle-plugin

Hi cortinico, I tried your suggestions step by step but the problem persists...

I'm so confused because yesterday I created a new proyect with 0.75.2 but it didn't run with 'npm run andoid' ( 'com.facebook.react.settings' error) so I changed it version to 0.75.1, after this, the project worked.

Today I tried to create other project following the previous 'hack' but 'com.facebook.react.settings' error is showing again.

MDavidMR avatar Aug 28 '24 19:08 MDavidMR

Hi @MDavidMR can you try to run gradlew clean and see if it resets the state of the machine? If you keep 0.75.2 and downgrade gradle to 8.7 as shown by @cortinico above, is the problem fixed?

cipolleschi avatar Aug 29 '24 09:08 cipolleschi

Not working with RN 0.75.1 as well.

harshmdr avatar Aug 29 '24 12:08 harshmdr

Hi @MDavidMR can you try to run gradlew clean and see if it resets the state of the machine? If you keep 0.75.2 and downgrade gradle to 8.7 as shown by @cortinico above, is the problem fixed?

yes it work for me i just downgraded gradle, deleted app/buld folder and then try to clean gradle. its done

Cyberfolks avatar Aug 29 '24 13:08 Cyberfolks

so it is due to https://github.com/facebook/react-native/issues/46210#issuecomment-2315211671 as Nicola pointed out. We can try to downgrade gradle and wait for 8.9 to come out with a fix. @blakef

cipolleschi avatar Aug 29 '24 14:08 cipolleschi

cd android ./gradlew clean ./gradlew --stop Then, go back to the root directory of your project and run: npx react-native run-android

I did this and it is working for me. You don't have to downgrade gradle with this method.

projectninjatech avatar Aug 29 '24 17:08 projectninjatech

cd android ./gradlew clean ./gradlew --stop Then, go back to the root directory of your project and run: npx react-native run-android

I did this and it is working for me. You don't have to downgrade gradle with this method.

I followed this, and working fine for me. Thanks dear

VcRajaa avatar Aug 29 '24 19:08 VcRajaa

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?

how did you downgrade react native?

Renmsd avatar Aug 30 '24 14:08 Renmsd