Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error Plugin [id: 'com.facebook.react.settings'] was not found in any of the following sources:, when upgrading to "react-native": "0.75.1"

I'm trying to upgrade React native 0.75.1, using https://react-native-community.github.io/upgrade-helper, but I'm running into an error.

Settings file 'mobile/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)

here is the file in Android > settings.gradle

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 = 'mobileAppName'
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')

which is what is required from the react-native upgrade helper.

I tried commenting out the line and adding the plugin in android/app/build.gradle like so:

apply plugin: "com.facebook.react"
apply plugin: "com.facebook.react.settings"
apply plugin: "com.google.gms.google-services"
apply plugin: "com.google.firebase.crashlytics"
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: "org.jetbrains.kotlin.android"

but the next line errors out:

A problem occurred evaluating settings 'android'.
Could not get unknown property 'com' for settings 'android' of type org.gradle.initialization.DefaultSettings.
from line
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }

so the plugin has to be imported in settings.gradle

does anyone have a solution or workaround to get the plugin "com.facebook.react.settings") working?

like image 926
DarkAdvent Avatar asked Dec 03 '25 00:12

DarkAdvent


2 Answers

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

https://github.com/facebook/react-native/issues/46046#issuecomment-2291641341

like image 158
Skander Hadjkacem Avatar answered Dec 05 '25 15:12

Skander Hadjkacem


I encountered the same error on Windows.

When I opened my project in Android Studio, it shown a warning:

Multiple Gradle daemons might be spawned because
the Gradle JDK and JAVA_HOME locations are different.

This resolved the issue for me:

  1. Set JAVA_HOME environment variable to C:\Program Files\Android\Android Studio\jbr
  2. Restart VSCode
like image 36
Matti Lehtinen Avatar answered Dec 05 '25 14:12

Matti Lehtinen