skip to Main Content

Trying to upgrade react native 0.75.1, using https://react-native-community.github.io/upgrade-helper.

running into 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 file android>settings.gradle

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.
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 
* What went wrong:
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??


2

Answers


  1. 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 FilesAndroidAndroid Studiojbr
    2. Restart VSCode
    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search