【问题标题】:Unable to run react native app android emulator无法运行反应本机应用程序android模拟器
【发布时间】:2023-03-29 17:11:02
【问题描述】:

我正在尝试在从另一个系统导入的 VS 代码中运行一个 react-native 项目 但是我收到以下错误,如下

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
env: sh\r: No such file or directory

at makeError (/Users/Siva/Desktop/RN/Innoppl-Liberate/Mobile/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:174:9)
at /Users/Siva/Desktop/RN/Innoppl-Liberate/Mobile/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async runOnAllDevices (/Users/Siva/Desktop/RN/Innoppl-Liberate/Mobile/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:106:5)
at async Command.handleAction (/Users/Siva/Desktop/RN/Innoppl-Liberate/Mobile/node_modules/@react-native-community/cli/build/index.js:192:9)

info 使用 --verbose 标志运行 CLI 以获取更多详细信息。

当我运行在我自己的设备中创建的 react-native 项目时,它运行良好,并且应用程序在模拟器中启动。

对于在我自己的设备中创建的项目来说,android 环境设置似乎工作得很好,因为导入的文件有错误 - 如何解决这个问题

【问题讨论】:

  • 在 android studio 中打开项目的 ./android/ 并尝试在那里构建。它会更好地建议对您的 gradle 插件的修复,然后从 CLI 执行 run android
  • 尝试在 android 文件夹而不是 react-native run-android 中执行这些命令。 1- ./gradlew assembleDebug 2- ./gradlew installDebug

标签: android ios react-native


【解决方案1】:

你能在项目根目录试试这个命令吗:

chmod 755 android/gradlew

【讨论】:

  • 试过但没用
猜你喜欢
  • 2018-10-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-05-15
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多