gpt4 book ai didi

react-native - 安装 react-redux 后,native_modules.gradle 文件将被删除

转载 作者:行者123 更新时间:2023-12-03 05:34:54 26 4
gpt4 key购买 nike

我为我的项目创建了一个原生 react 应用程序。当我将我的项目文件复制到 app 文件夹中然后运行该应用程序时,它说在 node_module 中 react-redux 不存在,然后我使用 npm install react-redux@7.0.3 安装了 react-redux之后在我的应用程序文件夹中运行 run-android该项目的命令提示符中的命令告诉 -Could not read script 'E:\AppFolder\MyApp\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' as it does not exist. .

之后,我删除了模拟器的数据并运行 run-android ,但它仍然给我同样的错误,并且应用程序没有安装在模拟器中。

这是命令提示符显示的错误:

info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)...
Starting a Gradle Daemon, 2 incompatible and 1 stopped Daemons could not be reused, use --status for details

FAILURE: Build failed with an exception.

* Where:
Settings file 'E:\AppFolder\MyApp\android\settings.gradle' line: 4

* What went wrong:
A problem occurred evaluating settings 'TribeBond'.
> Could not read script 'E:\AppFolder\MyApp\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' as it does not exist.

* 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

BUILD FAILED in 1m 10s
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.```

最佳答案

在这里,我按照以下步骤解决我的问题-

  • 我构建了一个新应用程序并使用 react-native run-android 运行它命令。
  • 然后我将所有依赖项一一安装,将在应用程序中使用。
  • 然后运行 ​​npm install项目中的命令。
  • 之后,我使用 react-native run-android 重新构建应用程序.
  • 还有田!该应用程序已重新构建,没有任何错误。
  • 关于react-native - 安装 react-redux 后,native_modules.gradle 文件将被删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57018581/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com