我在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)
我试图在谷歌上看这个,并且有太多的信息,没有解决方案。
有人已经收到此错误吗?
谢谢!
答案 0 :(得分:0)
是的,之前我遇到过这个错误。 但是作为您的日志,我们可以看到问题所在:
错误:未设置ANDROID_HOME且" android"命令不在你的PATH中。您必须至少满足其中一个条件。
您已安装sdk
,但未设置PATH
。
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
命令再次尝试。答案 1 :(得分:0)