首页 > 解决方案 > React 本机 android 应用程序构建未在 Mac 上运行

问题描述

当我尝试在 Mac 上运行它时,我已经在 Windows 上构建了一个反应本机应用程序,它给了我一个错误。只有当我尝试运行 android 时它才会显示这个错误,ios 运行完美。在我在 Mac 上构建它之后,即使在它之前编码的 Windows 系统中它也不会运行。

错误:-

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.

Error: spawnSync ./gradlew EACCES
at Object.spawnSync (internal/child_process.js:1041:20)
at spawnSync (child_process.js:607:24)
at execFileSync (child_process.js:634:15)
at runOnAllDevices (/Users/ideenkreise/Documents/GoalMate/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)

at buildAndRun (/Users/ideenkreise/Documents/GoalMate/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:158:41)
at /Users/ideenkreise/Documents/GoalMate/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Command.handleAction (/Users/ideenkreise/Documents/GoalMate/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js:164:9)

标签: androidmacosreact-native

解决方案


您无权执行 ./gradle

在项目根目录下运行以下命令

chmod 755 安卓/gradlew


推荐阅读