facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.16k stars 24.21k forks source link

Error resolving plugin [id: 'com.facebook.react.settings'] #46133

Closed adhikarisandil32 closed 2 weeks ago

adhikarisandil32 commented 3 weeks ago

Description

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.

359618830-15d3e0bb-760f-4d17-b888-31642e633297

Steps to reproduce

  1. Create the project files with npx @react-native-community/cli init ProjectName --directory ../ProjectDirectory
  2. After project files are created successfully, hit npm run start and Metro asks where to run, since i want to run it on android, I hit a
  3. Then the error shows up.

React Native Version

0.75.2

Affected Platforms

Runtime - Android, Build - Windows

Output of npx react-native info

System:
  OS: Windows 11 10.0.22631
  CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
  Memory: 1.69 GB / 7.90 GB
Binaries:
  Node:
    version: 20.10.0
    path: C:\Program Files\nodejs\node.EXE
  Yarn: Not Found
  npm:
    version: 10.2.3
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK:
    AllowAllTrustedApps: Disabled
IDEs:
  Android Studio: AI-241.18034.62.2411.12071903
  Visual Studio: Not Found
Languages:
  Java: 17.0.11
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.75.2
    wanted: 0.75.2
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

### Stacktrace or Logs

```text
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-df5899d5-a017-403d-b535-3a943b94f28a) to immutable location (F:\tutorial-practice\frontend-development\react-native\native-cli-todo-app-2\android\.gradle\8.8\dependencies-accessors\569c8b261a8a714d7731d5f568e0e5c05babae10)


### Reproducer

https://github.com/adhikarisandil32/native-cli-todo-app

### Screenshots and Videos

![Screenshot 2024-08-21 175545](https://github.com/user-attachments/assets/f31e772a-4f66-4c4f-bf1a-ed16b46a9a24)
cortinico commented 3 weeks ago

Could you remove this folder:

F:\tutorial-practice\frontend-development\react-native\native-cli-todo-app-2\android\.gradle

and try again?

cl3i550n commented 3 weeks ago

Same error here

FAILURE: Build failed with an exception.

* Where:
Settings file 'path\android\settings.gradle' line: 2

* What went wrong:
Error resolving plugin [id: 'com.facebook.react.settings']
> java.io.UncheckedIOException: Could not move temporary workspace (path\android\.gradle\8.8\dependencies-accessors\569c8b261a8a714d7731d5f568e0e5c05babae10-d437262d-9486-4a7e-a868-29b809f9924f) to immutable location (path\android\.gradle\8.8\dependencies-accessors\569c8b261a8a714d7731d5f568e0e5c05babae10)
adhikarisandil32 commented 3 weeks ago

Could you remove this folder:

F:\tutorial-practice\frontend-development\react-native\native-cli-todo-app-2\android\.gradle

and try again?

No Luck, sir @cortinico . The issue still persists. However I believe I've found, let's say, a hack. If I go npm run android on the VSCode terminal, along with the terminal it also opens command prompt automatically. The VSCode terminal shows error, but the command prompt terminal successfully runs development. Then I close the command prompt terminal. Stop the development server on the VSCode Terminal, clear the terminal and hit npm run start and then a. Now the app is successfully installed on my device without any error.

I create another app, and I've to do the same. And that's one tedious process.

Ricardo-Veiga-Lemes commented 3 weeks ago

I have the same problem. The "hack" didn't work for me.

adhikarisandil32 commented 3 weeks ago

I have the same problem. The "hack" didn't work for me.

.I'm using it on my actual real device. May be you could also try that on actual device. @Ricardo-Veiga-Lemes

ramilqO commented 3 weeks ago

I solve this problem with npm run android

Ricardo-Veiga-Lemes commented 3 weeks ago

image In all cases I have to press "a" to run android. When I run "npm run android" it opens the Windows terminal, but there I also have to press "a" to continue and then the same error returns. image

adhikarisandil32 commented 3 weeks ago

@Ricardo-Veiga-Lemes I'm using my real device. Are you using it too ? Also, why don't you delete the project and start a new completely new form the command npx @react-native-community/cli init ProjectName --directory ../DirectoryName not on the VSCode terminal but on windows terminal. And then open up the directory containinig project files, hit npm run android first, do as it says. Exit the windows terminal, stop the vscode terminal server, clear the console and hit npm run start and do as it says.

As I can see, your react-native project uses 0.75.1, but mine uses 0.75.2, the latest one I guess. And if nothing works, try creating an app with expo.

tecnologiacd2 commented 3 weeks ago

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 commented 2 weeks ago

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

don't work for me I go down until 0.73.6

MDavidMR commented 2 weeks ago

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

Thanks, it worked for me. I just changed the entries in the package.json file.

cortinico commented 2 weeks ago

Closign as this duplicates https://github.com/facebook/react-native/issues/46210

Let's keep the conversation only in one issue as it's impossible for us to help you otherwise