【发布时间】: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 assembleDebug2-./gradlew installDebug
标签: android ios react-native