react-native: [android] Plugin [id: 'com.facebook.react.settings'] was not found in any of the following sources

Description

build fail on android after upgrading from 0.74.5 to 0.75.1 caused by “/android/settings.gradle’ line: 2”

pluginManagement { includeBuild("../../../node_modules/@react-native/gradle-plugin") }
plugins { id("com.facebook.react.settings") }
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
rootProject.name = 'driver'
include ':app'
includeBuild('../../../node_modules/@react-native/gradle-plugin')

i’m using monorepo, i rechecked node_modules path and it is correct

Steps to reproduce

  1. upgrade to react-native@0.75.1
  2. react-native run-android

React Native Version

0.75.1

Affected Platforms

Runtime - Android

Output of npx react-native info

...

Stacktrace or Logs

FAILURE: Build failed with an exception.

* Where:
Settings file '/Users/hamoboker/Projects/shoory/shoory-mobile/apps/driver/android/settings.gradle' line: 2

* What went wrong:
Plugin [id: 'com.facebook.react.settings'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Included Builds (No included builds contain this plugin)
- Plugin Repositories (plugin dependency must include a version number for this source)

Reproducer

…

Screenshots and Videos

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 31
  • Comments: 97 (5 by maintainers)

Most upvoted comments

check your @react-native/gradle-plugin resolution in yarn.lock/package-lock.json; if you have any lingering other than 0.75.1 (eg i have 0.74.1 left in there) you have to remove node_modules and regenerate your lock file

@HamoBoker thanks for the update, I’m closing then:

@cortinico i solved my issue by removing rm -rf ~/.gradle/caches and restarting the device removing ~/.gradle/caches without restarting didn’t solve the problem so i guess restart is required after removing folder.

Generally doing:

cd android && ./gradlew --stop && rm -rf ~/.gradle/caches

should be sufficient rather than having to reboot.

Please open separate issues if you’re having similar problmes.

The real solution!!

After deeply investigated this issue, this is my verdict to fix the issue for React Native version 0.74.5.

  • This will not fix it: yarn react-native-clean-project.
  • IMHO not necessary: cd android && ./gradlew --stop && rm -rf ~/.gradle/caches && cd ..
  • Do not: yarn add @react-native/gradle-plugin@0.75.1 --exact. You don’t need it.

Is has everything to do with a dangling react-native/gradle-plugin in the yarn.lock file.

If you have the react-native-windows dependency in your package.json ensure it has the same version as the react-native dependency. Fix this first before performing the next steps. If this does not fix it after performing the steps below, it has something to do with another outdated dependency in the packages.json

Perform the next steps from the root of your project.

  1. Empty your yarn.lock file. (Deleting the file will make yarn unhappy)
  2. Delete node_modules
  3. Run: yarn install
  4. Run: cd android
  5. Run: gradlew clean
  6. Run: yarn android

This will fix it. Happy coding! 😄

Claro! Aqui está a tradução do seu passo a passo:


Simple solution:

  1. Restart your PC
  2. Navigate to your project
  3. Delete the .gradle folder
  4. Run cd android
  5. Run gradlew clean
  6. Run yarn android

Thank me later!!

same issue

I tried everything listed above but nothing is working.

i think you need to update your @react-native/gradle-plugin by npm install @react-native/gradle-plugin

@react-native/gradle-plugin

Adding it as a devDependency solved it for me

@lovegaoshi is right. Can you confirm you have @react-native/gradle-plugin version 0.75.1 installed?

Seems related to: https://github.com/gradle/gradle/issues/28974

I don’t have a solution at the moment and I also cannot reproduce:

https://github.com/user-attachments/assets/62058329-2649-4e1a-9c6b-e109a4fd70f7

I would have suggested to attempt removing the .gralde/caches folder which you already did. I’d like to see if other users are also having this problem or not

when u got that error just restart damn computer

@bizIshan i got the same issue today try gradlew clean --refresh-dependencies

Does anyone have this error ? image

Worked for me after installing @react-native/gradle-plugin 0.77 and upgrading distributionUrl to gradle-8.9-all.zip in gradle-wrapper.properties. My project is targeting to React Native version 0.75.3

This solution worked for me after 2 days 😃

Using react native cli ~0.75.3 and gradle version 8.8

Steps I did

  1. restart pc
  2. delete .android and .gradle from C:\User<username>
  3. deleted .gradle from android of the project folder, node_module, package.lock, yarn.lock
  4. changed 8.8 to 8.9 in gradle-wrapper.properties
  5. npm i
  6. updated this dependencies @react-native/gradle-plugin, react-native-gesture-handler, react-native-safe-area-context and added @react-native-community/cli
  7. Connect the mobile device and toggle usb debugging
  8. cd android and then ./gradlew clean
  9. npm run android

I struggled with the issue for 3 days, approximately around 10 to 12 hours. What worked for me was simply upgrading the react-native version.

i slove this issue C:\Users<your_username>.gradle\caches\ ./gradlew delete then install @react-native/gradle-plugin then update gradle-wrapper-propeties 8.8 to 8.9 then gradle clean and npm start then your project run properly

I am able to solve this with following steps:

Follow these steps to resolve it:

Solution Steps

  1. Delete the Gradle Cache Folder
    Remove the cached Gradle files to ensure a clean build:

    C:\Users\<your_username>\.gradle\caches\
    
  2. Delete the .gradle Directory in Your Project
    Navigate to your React Native project’s Android directory and delete the .gradle folder:

    C:\Users\<project_directory>\android\.gradle\
    
  3. Clean the Android Build (Optional)
    Open a terminal, navigate to the android folder, and run:

    cd android
    ./gradlew clean  # For macOS/Linux
    gradlew clean    # For Windows
    
  4. Reinstall the React Native Gradle Plugin
    Ensure you have the latest React Native Gradle plugin installed by running:

    npm install @react-native/gradle-plugin
    

After completing these steps, restart your IDE (Android Studio or VS Code) and try running your project again.

This should resolve the issue and allow you to build your React Native app successfully. 🚀

Getting this error:

error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build completed with 2 failures. 1: Task failed with an exception.

  • Where: Settings file ‘/Users/MyApp/android/settings.gradle’ line: 2 * What went wrong: Error resolving plugin [id: ‘com.facebook.react.settings’]

A problem occurred configuring project ‘:gradle-plugin:react-native-gradle-plugin’. > java.util.zip.ZipException: zip END header not found

https://stackoverflow.com/a/79235480/11043676

this resolve the issues without the downgrading any versions. i noticed this issue occurs due to misconfiguration of gradle files

I just ran into this issue when using expo@next and upgrading to new arch then downgrading.

My solution was was ./gradlew --stop && rm -rf ./gradle/caches && ./gradlew clean

Worth noting I also cleared node_module and deleted and prebuilt the android project to no prevail.

Currently my issue is related to gradle cache

Could not read workspace metadata from /Users/hamoboker/.gradle/caches/[GRADLE_VERSION]

getting this error on GRADLE_VERSION = 8.8 and 8.6

[UPDATE]

@cortinico i solved my issue by removing rm -rf ~/.gradle/caches and restarting the device removing ~/.gradle/caches without restarting didn’t solve the problem.

@devic021 can you try this and share feedback ? if issue still occur make sure you have @react-native/gradle-plugin installed

Projects tested on react-native@0.74.5 - gradle 8.6 react-native@0.75.1 - gradle 8.8

@lovegaoshi is right. Can you confirm you have @react-native/gradle-plugin version 0.75.1 installed?

I’ll recheck and give you feedback

For me, running the following command worked: @react-native/gradle-plugin -D

74FA52E5-4D74-4022-8ED1-7692AE4CB71A E98DE4E6-E79E-4502-9BBD-F4A46FA45591 Does anyone know what’s going on here have any idea what to do about it? react-native 0.71.3 Sync Project with Gradle Files Resulting error

Just started the project with the latest version of React Native at first build only got this error

  • What went wrong: Error resolving plugin [id: ‘com.facebook.react.settings’]

java.io.UncheckedIOException: Could not move temporary workspace

i tried removing gradle caches etc Nope!

FAILURE: Build failed with an exception.

  • Where: Settings file ‘D:\delet\reactnative\android\settings.gradle’ line: 2

  • What went wrong: Error resolving plugin [id: ‘com.facebook.react.settings’]

still showing same error “node_modules/@react-native/gradle-plugin”: { “version”: “0.75.1”, “resolved”: “https://registry.npmjs.org/@react-native/gradle-plugin/-/gradle-plugin-0.75.1.tgz”, “integrity”: “sha512-a2gVjX3MB9TF9QZSKje79n1GDAnseTU94VIcFH/4DS3KjbK3yrNXsu1maxGZxDUAKmTUH7Rz4An/Rb5nkZG7dw==”, “dev”: true, “engines”: { “node”: “>=18” } },

Hi @V-SATHISH2109, Last couple days ago, I was facing the same errors.

Below things work for me

  1. Recheck the installed JAVA SDK version, react-native 0.75 requires a min JAVA sdk version 17. JAVA -- version

  2. Clean the gradle caches via below command. cd android && ./gradlew --stop && rm -rf ~/.gradle/caches

@HamoBoker thanks for the update, I’m closing then:

@cortinico i solved my issue by removing rm -rf ~/.gradle/caches and restarting the device removing ~/.gradle/caches without restarting didn’t solve the problem so i guess restart is required after removing folder.

Generally doing:

cd android && ./gradlew --stop && rm -rf ~/.gradle/caches

should be sufficient rather than having to reboot.

@cortinico @HamoBoker Thanks, your solution works for me.

cd android && ./gradlew --stop && rm -rf ~/.gradle/caches

After 12 hours working, I decided to solve the problem and made next:

  • Reinstalled and fixed dependencies
  • Removed android build folder
  • Uninstall app from simulator
  • Restarted Mac
  • Started new “npx expo run:android” build

After this steps I haven’t met to this problem anymore. During build I have got another errors but with ChatGPT 4o I finished it successfully.

I struggled with the issue for 3 days, approximately around 10 to 12 hours. What worked for me was simply upgrading the react-native version.

Here is the solution

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

I am able to solve this with following steps: Follow these steps to resolve it:

Solution Steps

  1. Delete the Gradle Cache Folder Remove the cached Gradle files to ensure a clean build:
    C:\Users\<your_username>\.gradle\caches\
    
  2. Delete the .gradle Directory in Your Project Navigate to your React Native project’s Android directory and delete the .gradle folder:
    C:\Users\<project_directory>\android\.gradle\
    
  3. Clean the Android Build Open a terminal, navigate to the android folder, and run:
    cd android
    ./gradlew clean  # For macOS/Linux
    gradlew clean    # For Windows
    
  4. Reinstall the React Native Gradle Plugin Ensure you have the latest React Native Gradle plugin installed by running:
    npm install @react-native/gradle-plugin
    

After completing these steps, restart your IDE (Android Studio or VS Code) and try running your project again. This should resolve the issue and allow you to build your React Native app successfully. 🚀

./gradlew clean is giving this error

Image

You can skip 3rd step. Directly install @react-native/gradle-plugin. It should work for you.

Hi everyone, my team struggled with this issue today, and we managed to solve it in two different ways. I’m not sure if these methods will work for you, but it’s worth a try!

Solution 1 (My Case):

First, I rebuilt the entire project with the desired version of React Native:

npx @react-native-community/cli init projectname --version 0.76

then

cd projectname

Note: Using community/cli is mandatory; the version is optional.

Then, I ran:

yarn add <all the libraries the project needs>

After that, I ran:

yarn react-native doctor

This ensures everything is set up correctly (everything should show as checked).

Image

Finally, the most important part:

npm run android

Yes, use npm here, not yarn—I don’t know why, but it worked for me!

Solution 2 (For My Friend):

For my friend, this approach didn’t work initially, so we had to take some extra steps:

Delete the node_modules folder.

And run:

yarn install

Then, run:

npm run android

This worked for both of us (with a few additional steps on my friend’s machine). Just make sure that react-native doctor shows everything as checked, otherwise you may face this issue again.

Good luck, keep coding, and be blessed! 🙏

Image

Same issue, Can any one explain what cause this issue all of sudden ?

I am able to solve this with following steps:

Follow these steps to resolve it:

Solution Steps

  1. Delete the Gradle Cache Folder Remove the cached Gradle files to ensure a clean build:
    C:\Users\<your_username>\.gradle\caches\
    
  2. Delete the .gradle Directory in Your Project Navigate to your React Native project’s Android directory and delete the .gradle folder:
    C:\Users\<project_directory>\android\.gradle\
    
  3. Clean the Android Build Open a terminal, navigate to the android folder, and run:
    cd android
    ./gradlew clean  # For macOS/Linux
    gradlew clean    # For Windows
    
  4. Reinstall the React Native Gradle Plugin Ensure you have the latest React Native Gradle plugin installed by running:
    npm install @react-native/gradle-plugin
    

After completing these steps, restart your IDE (Android Studio or VS Code) and try running your project again.

This should resolve the issue and allow you to build your React Native app successfully. 🚀

./gradlew clean is giving this error

Image

I solved the issue uninstalling the java plugins in VSC, and creating a new project without that plugins

@El-mou33 Were you able to fix the issue in existing react-native app ?

I didn’t try, my project was really small so it was easy for me restarting the project. Maybe combining other solutions with removing the Java plugins will help. I realised creating a new project in a clean computer that when you install Java plugins on VSC it edits some parts of android graddle folder.

FAILURE: Build failed with an exception.

  • Where: Settings file ‘D:\delet\reactnative\android\settings.gradle’ line: 2
  • What went wrong: Error resolving plugin [id: ‘com.facebook.react.settings’]

still showing same error “node_modules/@react-native/gradle-plugin”: { “version”: “0.75.1”, “resolved”: “https://registry.npmjs.org/@react-native/gradle-plugin/-/gradle-plugin-0.75.1.tgz”, “integrity”: “sha512-a2gVjX3MB9TF9QZSKje79n1GDAnseTU94VIcFH/4DS3KjbK3yrNXsu1maxGZxDUAKmTUH7Rz4An/Rb5nkZG7dw==”, “dev”: true, “engines”: { “node”: “>=18” } },

Hi @V-SATHISH2109, Last couple days ago, I was facing the same errors.

Below things work for me

1. Recheck the installed JAVA SDK version,   react-native 0.75 requires a min JAVA sdk version 17.
   `JAVA -- version`

2. Clean the gradle caches via below command.
   `cd android && ./gradlew --stop && rm -rf ~/.gradle/caches`

thank you, this did the trick after cleaning node_modules : cd android && ./gradlew --stop && rm -rf ~/.gradle/caches

I never liked gradle and now it’s officially added to the list of crapware 😃. Would one need a file a bug for this ? I am glad it solved it, thank you!

@cortinico @HamoBoker Thanks, your solution works for me. Thank you so much, you saved my day!

Claro! Aqui está a tradução do seu passo a passo:

Simple solution:

  1. Restart your PC
  2. Navigate to your project
  3. Delete the .gradle folder
  4. Run cd android
  5. Run gradlew clean
  6. Run yarn android

Thank me later!!

I had the same issue unitl I followed these step. Thank you so much issue resolved.

FAILURE: Build failed with an exception.

  • Where: Settings file ‘D:\delet\reactnative\android\settings.gradle’ line: 2

  • What went wrong: Error resolving plugin [id: ‘com.facebook.react.settings’]

still showing same error “node_modules/@react-native/gradle-plugin”: { “version”: “0.75.1”, “resolved”: “https://registry.npmjs.org/@react-native/gradle-plugin/-/gradle-plugin-0.75.1.tgz”, “integrity”: “sha512-a2gVjX3MB9TF9QZSKje79n1GDAnseTU94VIcFH/4DS3KjbK3yrNXsu1maxGZxDUAKmTUH7Rz4An/Rb5nkZG7dw==”, “dev”: true, “engines”: { “node”: “>=18” } },