I am starting to follow this demo for learning the ionic framework.
I made it to the point where it suggests that I type in ionic platform android
. When I type that, I get this error:
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)
I am on Mac OSX. I have developed two android apps before using Android Studio. I also followed the suggestion for OSX on the manual $ export JAVA_HOME=$(/usr/libexec/java_home)
but this did not fix the problem.
如果您通过Homebrew安装了Android SDK,那么修复是这样的:
export ANDROID_HOME=`brew --prefix android`
on macosx it will be like this
step1
open and edit the profile
vi ~/.bash_profile
step2
the bash_profile would be like below (this is my edition)
export ANDROID_HOME=/Users/Zam/Documents/android-sdk-macosx export PATH=$ANDROID_HOME/tools:$PATH
for you, it shuold use your sdk location
export ANDROID_HOME=where your sdk location export PATH=$ANDROID_HOME/tools:$PATH
step3
refresh
source ~/.bash_profile
在Windows上设置系统变量中的ANDROID_HOME
如果您通过Homebrew安装了Android SDK,请修复此问题:
export ANDROID_HOME=`brew --prefix android`
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.