【问题标题】:cordova build android throws error on Ubuntu 12.04cordova build android 在 Ubuntu 12.04 上抛出错误
【发布时间】:2015-04-05 19:04:14
【问题描述】:

这个问题看起来很熟悉 Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.

但我无法修复它。当我跑步时

% 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

这是完美的位置 & android 命令也可以正常工作。 请帮忙.. 我正在使用科尔多瓦 4.3.0

【问题讨论】:

  • 你为什么运行sudo cordova build android而不是cordova build android

标签: android cordova


【解决方案1】:

这...

sudo cordova build android  

root 的环境中运行,而这个 ...

echo $ANDROID_HOME

没有作为 root 执行。检查echo $ANDROID_HOME 作为 root 返回的内容 - 或(强烈推荐) - 以 root 以外的其他用户身份运行 Cordova。

p.s.:我在没有sudo 的情况下在 Ubuntu 14.04 上运行 Cordova 4.0.0。

【讨论】:

  • 谢谢.. 这就是问题所在。上帝保佑
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-09-02
  • 1970-01-01
  • 1970-01-01
  • 2018-12-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多