React Native 构建在 android 中失败,@react-native-community/cli-platform-android /native_modules.gradle' 行:130

新手上路,请多包涵

我已将我的 ReactNative 项目从 0.59 升级到 0.61.2 iOS 构建良好,但在 android 中我面临 @react-native-community/cli-platform-android 模块中的问题。

我的 settings.gradle 文件

apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

我的 build.gradle 文件

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

构建应用程序时出现以下错误。

 > Task :app:generatePackageList FAILED

FAILURE: Build failed with an exception.

* Where:
Script '/Users/yashwanth_c/Documents/projects/MobileApp/node_modules/@react-native-community/cli-platform-android
/native_modules.gradle' line: 130

* What went wrong:
Execution failed for task ':app:generatePackageList'.
> ReactNativeModules$_generatePackagesFile_closure3

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.5/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 5m 21s
4 actionable tasks: 4 executed

与往常一样,我清理了缓存并删除了 node_module 文件夹,尝试了很多次但没有运气。也用谷歌搜索了一个多星期,但仍然无法找到解决方法,不胜感激。

原文由 Yashwanth 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 2k
1 个回答

我遇到了同样的问题,然后我尝试了以下命令。它对我有用。这意味着,手动安装 android cli 包。

 npm i @react-native-community/cli-platform-android

如果有人知道另一种解决方案,请在此处分享。

原文由 Elavarasan r 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题