2015-04-05 133 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

相關問題