android - ionic 错误: may not have the required environment or OS to build this project

标签 android compiler-errors ionic-framework ionic

我在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上查看此内容,但信息过多,对此没有解决方案。

有人已经收到此错误?

谢谢!

最佳答案

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

Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.


您已经安装了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

    关于android - ionic 错误: may not have the required environment or OS to build this project,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33524768/

    相关文章:

    java - JSONObject 无法转换为 JSONArray - Android

    android - 关于广播接收器和服务

    c - 简单代码 : "declared argument argc is missing" 上的 A/UX cc 编译器错误

    qt - 运行一个简单的Qt程序

    html - 我们如何将所需的 CSS 应用于完整的 ionic 应用程序框架

    ios - Ionic 3 IOS App 不适用于首次启动,但在强制终止并启动后可以运行

    javascript - ionic 检查多个 Promise 是否完成

    android - 从移动应用程序执行 Google Apps 脚本函数

    java - Android:状态栏的跳跃效果

    c++ - 对 unsigned char C++ 的无效分配