cordova build android 报错 ANDROID_HOME is not set

运行

$cordova build android
[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: /Users/albert/Bloom/BloomateStore/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /Users/albert/Bloom/BloomateStore/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:135:23)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:735:16)
    at Process.ChildProcess._handle.onexit (child_process.js:802:5)

请问这个ANDROID_HOME应该如何设置,在网上找了一圈,都没有解决这个问题
PS:
OSX系统 build ios 成功了
android 之前 build 成功过 现在则一直报这个错,不知道是动了哪里了

阅读 9.6k
2 个回答

ANDROID_HOME是环境变量,指向你的Android SDK目录如果是windows的话直接设置即可。
*nix/OSX 使用.bashrc export一下。

在环境变量里面配置,变量名为ANDROID_HOME,变量值为你安装android-sdk的地址,你也可以参考http://www.ifcoder.us/看看

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题