我开始关注this演示来学习离子框架。
我已经达到了表明我输入ionic platform android
的程度。当我输入时,我收到此错误:
C02FF724DF91:todo jcorser$ ionic platform android
Creating android project...
/Users/jcorser/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:126
throw e;
^
Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.
at /Users/jcorser/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/lib/check_reqs.js:158:19
at _fulfilled (/Users/jcorser/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/Users/jcorser/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/Users/jcorser/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:760:13)
at /Users/jcorser/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:821:14
at flush (/Users/jcorser/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:419:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
at node.js:906:3
Error: /Users/jcorser/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/create: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:755:16)
at Process.ChildProcess._handle.onexit (child_process.js:822:5)
我在Mac OSX上。我在使用Android Studio之前开发了两个Android应用程序。我还在手册$ export JAVA_HOME=$(/usr/libexec/java_home)
上遵循OSX的建议,但这并没有解决问题。
答案 0 :(得分:28)
如果你通过Homebrew安装了Android SDK,那么修复就是:
export ANDROID_HOME=`brew --prefix android`
答案 1 :(得分:10)
在macosx上就像这样
<强>步骤1 强>
打开并修改个人资料
vi ~/.bash_profile
<强>步骤2 强>
bash_profile就像下面(这是我的版本)
export ANDROID_HOME=/Users/Zam/Documents/android-sdk-macosx export PATH=$ANDROID_HOME/tools:$PATH
对你来说,它应该使用你的sdk位置
export ANDROID_HOME=where your sdk location export PATH=$ANDROID_HOME/tools:$PATH
<强>步骤3 强>
刷新
source ~/.bash_profile
答案 2 :(得分:1)
在Windows上设置系统变量中的ANDROID_HOME
答案 3 :(得分:0)
如果您通过Homebrew安装了Android SDK,请修复此问题:
export ANDROID_HOME=`brew --prefix android`