在使用 React Native 0.76 创建项目时,遇到以下错误:
FAILURE: Build failed with an exception.
* Where:
Settings file '/Users/wangxp/learn/AwesomeProject/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)
问题概述
在 React Native 0.76 版本中,当通过官方命令行工具 npx @react-native-community/cli init AwesomeProject --version 0.76.0
创建一个新项目后,执行 yarn android
构建 Android 项目时,出现了上述错误,提示找不到插件 com.facebook.react.settings
。
根据 GitHub 问题 #46046,执行