我在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文件夹中OK
,OK
,OK
ionic
命令重试。 对于Ubuntu,我不使用此操作系统,因此请检查此solution
关于android - ionic 错误: may not have the required environment or OS to build this project,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33524768/