简体   繁体   English

错误:运行子进程cordova时发生错误

[英]ERROR: An error occurred while running subprocess cordova

I build an app on Ionic framework, it works on the browser but when I try to compile it on the emulator I have got this error:我在 Ionic 框架上构建了一个应用程序,它可以在浏览器上运行,但是当我尝试在模拟器上编译它时出现此错误:

Checking Java JDK and Android SDK versions ANDROID_SDK_ROOT=undefined (recommended setting) ANDROID_HOME=C:\Users\user\AppData\Local\Android\Sdk (DEPRECATED) Starting a Gradle Daemon (subsequent builds will be faster)检查 Java JDK 和 Android SDK 版本 ANDROID_SDK_ROOT=undefined (推荐设置) ANDROID_HOME=C:\Users\user\AppData\Local\Android\Sdk (DEPRECATED) 启动 Gradle Daemon (后续构建会更快)

FAILURE: Build failed with an exception. FAILURE:构建失败并出现异常。

  • What went wrong: Unable to start the daemon process.出了什么问题:无法启动守护进程。 This problem might be caused by incorrect configuration of the daemon.此问题可能是由于守护程序配置不正确造成的。 For example, an unrecognized jvm option is used.例如,使用了无法识别的 jvm 选项。 Please refer to the User Manual chapter on the daemon at https://docs.gradle.org/5.3.1/userguide/gradle_daemon.html Process command line: C:\Program Files (x86)\Java\jdk1.8.0_201\bin\java.exe -Xmx2048m -Dfile.encoding=windows-1252 -Duser.country=SA -Duser.language=ar -Duser.variant -cp C:\Gradle\gradle-5.3.1\lib\gradle-launcher-5.3.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 5.3.1请参考https://docs.gradle.org/5.3.1/userguide/gradle_daemon.html上有关守护进程的用户手册章节 进程命令行:C:\Program Files (x86)\Java\jdk1.8.0_201\ bin\java.exe -Xmx2048m -Dfile.encoding=windows-1252 -Duser.country=SA -Duser.language=ar -Duser.variant -cp C:\Gradle\gradle-5.3.1\lib\gradle-launcher- 5.3.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 5.3.1

    Please read the following process output to find out more:请阅读以下流程输出以了解更多信息:

Error occurred during initialization of VM Could not reserve enough space for 2097152KB object heap初始化 VM 时发生错误无法为 2097152KB 对象堆保留足够的空间

  • Try: Run with --stacktrace option to get the stack trace.尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。 Run with --info or --debug option to get more log output.使用 --info 或 --debug 选项运行以获得更多日志输出。 Run with --scan to get full insights.运行 --scan 以获得完整的见解。

  • Get more help at https://help.gradle.org C:\Gradle\gradle-5.3.1\bin\gradle: Command failed with exit code 1 [ERROR] An error occurred while running subprocess cordova.https://help.gradle.org C:\Gradle\gradle-5.3.1\bin\gradle 获得更多帮助:命令失败,退出代码 1 [错误] 运行子进程 cordova 时出错。

     cordova run android exited with exit code 1. Re-running this command with the --verbose flag may provide more information.

This is because the path to Android Sdk is not set correctly.这是因为未正确设置 Android Sdk 的路径。 Please check the correct path for Sdk, tools, platform-tools, emulator and Android build-tools.请检查 Sdk、工具、平台工具、模拟器和 Android 构建工具的正确路径。

Please, realize that the configuration recommended for Ionic has changed a bit.请注意,为 Ionic 推荐的配置已经发生了一些变化。 Now the notation recommended is as follows:现在推荐的符号如下:

ANDROID_SDK_ROOT=/home/username/Android/Sdk (recommended setting)
ANDROID_HOME=/home/username/Android/Sdk (DEPRECATED)

In Linux or Mac OS X configure the path into the ~/.bashrc, ~/.bash_profile file:在 Linux 或 Mac OS X 中,将路径配置到 ~/.bashrc、~/.bash_profile 文件中:

export ANDROID_SDK_ROOT=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/bin
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
export PATH=$PATH:$ANDROID_SDK_ROOT/build-tools

At the end, after save the configuration dont forget to do the command:最后,保存配置后不要忘记执行命令:

source ~/.bashrc

or as your case或作为你的情况

source ~/.bash_profile

For the Windows users check the global variables.对于 Windows 用户,请检查全局变量。

尝试运行npm cache clean并重新安装cordova ...为我工作。

I finally found the solution from a related solved topic: The solution is:我终于从一个相关的已解决主题中找到了解决方案:解决方案是:

ionic platform rm android ionic platform add android@latest ionic resources ionic run android ionic platform rm android ionic platform add android@latest ionic 资源 ionic run android

ionic repair worked for me. ionic repair对我有用。 Just give it a try and see if that works for you.试一试,看看它是否适合你。 Good luck!祝你好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误 - 运行子进程cordova时发生错误 - ERROR - An error occurred while running subprocess cordova Ionic Error:运行subprocess cordova时发生错误 - Ionic Error: An error occurred while running subprocess cordova 运行子进程cordova 时出错。 为什么? - An error occurred while running subprocess cordova. Why? 错误 ENOENT 没有这样的文件或目录 错误 运行子进程 cordova 时发生错误 - Error ENOENT no such file or directory ERROR An error occurred while running subprocess cordova 运行子进程 native-run 时出错 - An error occurred while running subprocess native-run 运行cordova build android时发生错误(退出代码1) - An error occurred while running cordova build android (exit code 1) 运行ionic cordova build android --prod --release时发生错误 - An error occurred while running ionic cordova build android --prod --release 创建新 Ionic 项目时运行子过程电容器时发生错误 - An error occurred while running subprocess capacitor when creating new Ionic project 部署ionic应用程序时如何解决“运行子进程ng时发生错误”? - How can I resolve "An error occurred while running subprocess ng" when deploying ionic app? IONIC 3 [ERROR] 运行cordova run android 时出错(退出代码1) - IONIC 3 [ERROR] An error occurred while running cordova run android (exit code 1)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM