react-native run-android 命令失败,但 gradlew installDebug 工作

新手上路,请多包涵

我在 OSX 上使用 react-native 0.43.3。我试图在 Android 上运行应用程序并收到消息

react-native run-android

Scanning 568 folders for symlinks in /Users/ruci.k/project/mayacrew/supermembers/supermembers/node_modules (5ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
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/android-setup.html

./gradlew installDebug 给了我一些错误并修复了它。最后构建成功并且应用程序正在Android设备上运行。

但是 react-native run-android 命令仍然不起作用。只有 ./gradlew installDebug 命令有效。

我可以检查使用 react-native run-android 命令吗?

我无法理解它是怎么发生的。

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

阅读 871
1 个回答

仔细检查错误消息。它会为出了什么问题提供线索。就我而言,在我的 react-native 项目中安装 expo 后,MainApplication.java 已损坏。我与备份进行了比较(您可以检查早期的工作提交),然后删除错误行。

在此之后,它起作用了。

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

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