2015-04-05 134 views
2

这个问题看起来很熟悉这个 Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.科尔多瓦构建Android抛出错误在Ubuntu 12.04

但我不能修复它。当我运行

% sudo cordova build android 

我收到以下错误

Running command: /home/thabung/mobile/hello/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/thabung/mobile/hello/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/thabung/mobile/hello/platforms/android/cordova/build: Command failed with exit code 2 
at ChildProcess.whenDone (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23) 
    at ChildProcess.emit (events.js:98:17) 
    at maybeClose (child_process.js:766:16) 
    at Process.ChildProcess._handle.onexit (child_process.js:833:5) 

几件事情我观察

% echo $ANDROID_HOME 

返回我

~/mobile/android-sdk-linux 

这是完美的位置 &安卓命令也正常工作。 请帮助.. 我使用的科尔多瓦4.3.0

+2

你为什么运行'sudo cordova build android'而不是'cordova build android'? – Trinimon 2015-04-05 19:19:45

回答

2

这...

sudo cordova build android 

运行在而这个环境......

echo $ANDROID_HOME 

不执行为。检查echo $ANDROID_HOME返回为 - 或(强烈推荐) - 运行Cordova作为另一个用户,而不是

p.s.:我在Ubuntu 14.04上运行Cordova 4.0.0,没有sudo

+0

谢谢。这就是问题所在。上帝保佑 – Thabung 2015-04-06 17:18:36

相关问题