facebook / react-native

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

Cannot build project after a clean setup without expo #46061

Closed shen020598 closed 2 months ago

shen020598 commented 2 months ago

Description

After create a new project npx @react-native-community/cli@latest init AwesomeProject as documented in

It appears the following error when trying to run on android : Error resolving plugin [id: 'com.facebook.react.settings']

Steps to reproduce

  1. npx @react-native-community/cli@latest init AwesomeProject
  2. yarn install
  3. npm run start
  4. a

React Native Version

0.75.1

Affected Platforms

Runtime - Android, Build - Windows

Output of npx react-native info

System:
  OS: Windows 11 10.0.22631
  CPU: (24) x64 12th Gen Intel(R) Core(TM) i9-12900K
  Memory: 18.35 GB / 31.77 GB
Binaries:
  Node:
    version: 22.5.1
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 3.6.4
    path: ~\AppData\Roaming\npm\yarn.CMD
  npm:
    version: 10.8.2
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK: Not Found
IDEs:
  Android Studio: AI-233.14808.21.2331.11709847
  Visual Studio: Not Found
Languages:
  Java: 17.0.12
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.75.1
    wanted: 0.75.1
  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

FAILURE: Build failed with an exception.

* Where:
Settings file 'C:\Users\shen\Desktop\work\AwesomeProject\android\settings.gradle' line: 2

* What went wrong:
Error resolving plugin [id: 'com.facebook.react.settings']
> java.io.UncheckedIOException: Could not move temporary workspace (C:\Users\shen\Desktop\work\AwesomeProject\android\.gradle\8.8\dependencies-accessors\569c8b261a8a714d7731d5f568e0e5c05babae10-3a9d3fee-7a12-496f-9c05-41c9103e6cb2) to immutable location (C:\Users\shen\Desktop\work\AwesomeProject\android\.gradle\8.8\dependencies-accessors\569c8b261a8a714d7731d5f568e0e5c05babae10)

Reproducer

https://github.com/react-native-community/reproducer-react-native

Screenshots and Videos

No response

react-native-bot commented 2 months ago
: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 commented 2 months ago
:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
cortinico commented 2 months ago

Cannot reproduce your issue:

https://github.com/user-attachments/assets/20a00d0b-d789-49e8-991b-0ac45fe4f320

shen020598 commented 2 months ago

Issue identified, we should use latest version of android studio when building project. Problem resolve when doing clean install of latest android studio.

Previous Android Studio Version : Jellyfish | 2023.3.1 Working Version (as of 0.75.1) : Koala | 2024.1.1

the reference below shown supported agp version by android studio reference : https://developer.android.com/studio/releases

@cortinico thank you for your kind help ^_^

cortinico commented 2 months ago

@cortinico thank you for your kind help ^_^

Happy to support, I'm glad you found the solution 🙏

tommmoe commented 1 month ago

I get the same issue, I'm running Koala and have only started using React as of three days ago.

Had no issues setting it up and starting my project, was able to build and everything.

Had an issue building today, tried to start a new project and now I'm stuck here, I've cleared the .gradle folder, re-installed npm.

I've even tried a fresh install of Android Studio.. no luck, I'm assuming that it's an environment issue but I can't find what the issue is.

FAILURE: Build failed with an exception.

edit Resolved after:

zkteco-home commented 1 month ago

same issue

deep02g commented 1 month ago

same issue. @tommmoe If i manually install nodejs from chocolatey, isn't npm folder automatically created? If you can elaborate how you resolved it? Please, Thank you.

ustuncem commented 1 month ago

same issue on clean install

edit: issue is fixed after manually deleting the android/build folder

tommmoe commented 1 month ago

same issue. @tommmoe If i manually install nodejs from chocolatey, isn't npm folder automatically created? If you can elaborate how you resolved it? Please, Thank you.

I didn't use chocolatey, I just used the nodejs installer for Windows, it installed but when I went to run npm commands, it complained about the npm folder not being accessible, once that was created the issue disappeared and everything worked correctly.

Of course I cleared my .gradle folder as well.

ncking commented 1 month ago

Cannot reproduce your issue:

Screen.Recording.2024-08-16.at.11.04.14.mov

Is this on Windows, as per the OP? Im on Windows/Koala and get the same as the OP, when floowing your commands on a clean install