Ionic错误:可能没有构建此项目所需的环境或操作系统

问题描述 投票:0回答:2

我正在Ubuntu上运行Ionic。我已经安装了Android SDK,并且已经安装了可以使用它的工具。

[当我尝试运行ionic build android时出现错误:

Running command: /home/fernando/Dropbox/Code/Kelps/KelpsApp/platforms/android/cordova/build 
[Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.]
ERROR building one of the platforms: Error: /home/fernando/Dropbox/Code/Kelps/KelpsApp/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /home/fernando/Dropbox/Code/Kelps/KelpsApp/platforms/android/cordova/build: Command failed with exit code 2
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1015:16)
    at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

我试图在Google上查看此内容,但信息过多,对此没有解决方案。

有人已经收到此错误吗?

谢谢!

android compiler-errors ionic-framework ionic
2个回答
0
投票

是,我之前遇到过此错误。但是作为您的日志,我们可以看到问题出在哪里:

错误:未设置ANDROID_HOME,并且PATH中未包含“ android”命令。您必须至少满足以下条件之一。

您已经安装了sdk,但尚未将其设置为PATH

对于Windows用户,请尝试以下步骤:

  • 从以下位置打开系统环境:
  • Control Panel-> System-> Advanced system settings->选择Advance选项卡
  • 单击Environment Variables...
  • User variables for ...部分中,单击New按钮。
  • 然后在ANDROID_HOME中键入Variable name,然后在the path中键入Variable Value到sdk文件夹>
  • OKOKOK
  • 重新启动命令行,然后使用ionic命令重试。
  • 对于Ubuntu,我不使用此操作系统,因此请检查此solution


0
投票

在此职位上找到我的答案:

© www.soinside.com 2019 - 2024. All rights reserved.