javascript - 命令失败:gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
问题描述
我是 react-native 开发的新手。我正在尝试来自 Facebook git hub 的一个简单的 react-native 项目。我已按照所有步骤操作,但是当我尝试通过键入来运行项目时
react-native run-android
它只是向我显示以下错误:
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 864 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Launching emulator...
info Successfully launched emulator.
info Installing the app...
Warning: No leading - on line 1 of `C:\Program Files\Java\jdk-13\lib\jvm.cfg'
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: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Warning: No leading - on line 1 of `C:\Program Files\Java\jdk-13\lib\jvm.cfg'
at checkExecSyncError (child_process.js:611:11)
at execFileSync (child_process.js:629:15)
at runOnAllDevices (C:\Users\Toshiba\Documents\AwesomeProject\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Command.handleAction (C:\Users\Toshiba\Documents\AwesomeProject\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:164:9)
解决方案
原来我的Java有问题。我卸载了 JDK 和 JRE 并重新安装了最新版本,它对我有用。
推荐阅读
- c++ - int* a 和 int* a =new int 的区别
- php - 如何在不提取的情况下在php中打开文件系统映像
- css - 忽略模态中的 CSS
- javascript - 语义 UI 搜索表单未获取对象数据
- linux - 端口 8080 上的 Nginx HTTPS
- c - C结构初始化
- angular - 延迟加载 Angular 与传统 MPA 有什么区别?
- visual-studio-2019 - 我无法在 CefSharp (ChromiumBrowser) 中观看 youtube 直播
- bash - 终端被 vscode 永久修改
- python - 我将如何更改 Alex 网络的 input_shape(使用 tf-keras)?