Both. I use only command line plus the android project can’t be build in Xcode.
This is the build error (the run one is similar):
[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/Norman/Sites/AppMobile/iWish/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/Norman/Sites/AppMobile/iWish/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:134:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
Well good luck, I have no clue.
I had a similar problem and I looked at the cordova js source code to understand under which conditions this error message was issued and then I printed some values from the script itself.
I have no clue too, that’s why I’ve asked help. It’s a stupid and no-sense issue!
NO! I’VE TRIED TO BUILD A BRAND NEW APP AND… NO ERRORS! I’m working on that app since a couple of month! I MUST build that! Advise about that?
If i’m trying to build the android versione without the sudo this is the error:
rm: could not remove directory (code EACCES): /Users/…
Have you tried to remove android platform in your project and then re-add it?
You should not be required to use sudo if you had installed node as non privileged user by using nvm. Many node/npm issues come from this bad way of installing it.
FIXED! HERE THE SOLUTION! (just if you have all working well, so it worked at least one!)
Problem:
You’re working well with your Ionic app when a sad day the ANDROID_HOME error is shown.
What should be the problem? Maybe you’ve worked with some other framework like crashlytics to manage beta and crashes.
Solution:
The permissions are changed (probably) so make the following:
Restore the right folder permission to all the folder/subfolder of the platforms folder
Delete the android platform with “sudo ionic platform remove android”
Add the android platform with “ionic platform add android” DON’T USE THE SUDO! If there are errors without the sudo SO that’s the problem! NEVER use the sudo thing or the project will have issue like this!
I’ve think the same thing @gmarziou when I sent the post. I’ve found the fix because the new project didn’t ask for admin password but the old one does.
We get it at the same time Thanks for the support!
FINALLY I can go on! I hope this can help you, dude that is reading this
EXCELLENT!!! I wish I’ve found this post earlier, there’s tons of posts with this exact same problem opened without any solution that actually works… I spent nearly a week messing with the system env paths, re-downloading and re-installing the big Android SDK (takes hours with my Internet speed), thinking that I was doing it wrong…
I don’t remember which module/framework that changed the permissions of some files/folders, but I can tell it happened because at one point I had to restore the permissions of “package.json” otherwise it wouldn’t let me install other modules without using “sudo”…