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.
To run your app, all you have to do is enable USB debugging and Developer Mode on your Android device, then run ionic cordova run android --device from the command line. Enabling USB debugging and Developer Mode can vary between devices, but is easy to look up with a Google search.
If you installed Android SDK via Homebrew, then the fix is this:
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
On windows set the ANDROID_HOME
in System Variables
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With