首页 > 解决方案 > 在运行 react-native run-android 时遇到问题

问题描述

自从我安装了 react-native-vector-icons 后,我一直在尝试在我的 android 上运行该应用程序时遇到麻烦。

这是我尝试 react-native run-android 命令时显示的内容:

FAILURE:构建失败并出现异常。

10 秒内构建失败

错误 无法安装应用程序。确保您已设置 Android 开发环境:https ://facebook.github.io/react-native/docs/getting-started.html#android-development-environment 。使用 --verbose 标志运行 CLI 以获取更多详细信息。错误:命令失败:gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE:构建失败并出现异常。

10 秒内构建失败

at checkExecSyncError (child_process.js:621:11)
at execFileSync (child_process.js:639:15)
at runOnAllDevices (C:\Users\Pichau\Desktop\PetCare-RN\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:74:39)
at buildAndRun (C:\Users\Pichau\Desktop\PetCare-RN\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
at C:\Users\Pichau\Desktop\PetCare-RN\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12
at processTicksAndRejections (internal/process/task_queues.js:85:5)
at async Command.handleAction (C:\Users\Pichau\Desktop\PetCare-RN\node_modules\@react-native-community\cli\build\cliEntry.js:160:7)

标签: androidreact-nativereact-native-android

解决方案


这是我的 package.json 文件 { "name": "petcare", "version": "0.0.1", "private": true, "scripts": { "start": "react-native start", "test" : "jest" }, "dependencies": { "react": "16.8.6", "react-native": "0.60.5", "react-native-gesture-handler": "^1.3.0", “react-native-vector-icons”:“^6.6.0”,“react-navigation”:“^3.11.1”},“devDependencies”:{“@babel/core”:“^7.5.0”, “@babel/runtime”:“^7.5.0”、“@react-native-community/eslint-config”:“^0.0.3”、“babel-jest”:“^24.1.0”、“jest” :“^24.1.0”、“metro-react-native-babel-preset”:“0.54.1”、“react-test-renderer”:“16.8.6”}、“jest”:{“preset”:“反应原生“}}


推荐阅读