Error when trying to install Android on Mac on command line


I’ve been following this instructions to install Ionic and Cordova on my Mac Air. I’ve been using PhoneGap Build for over a year and although you can use it with Ionic I though it would be nice to use regular Cordova on my Mac.

I can install the iOS version fine and running “ionic build iOS” is fine.

But when I try “ionic build android” get a huge list of errors, starting with:

“Error: ANDROID_HOME is not set and “android” command not in your PATH. You must fulfill at least one of these conditions.”

I’ve run: “export PATH=${PATH}:/Development/adt-bundle/sdk/platform-tools:/Development/adt-bundle/sdk/tools”

at the command line but it doesn’t help. My Android SDK is in “Development/adt-bundle/”

Does anyone know how I can fix this?


Try and export the ANDROID_HOME var with the path to your SDK. in your bash_profile do this
then update your process with your new bash_profile by running source ~/.bash_profile in your current terminal window


Thanks Hendrixer.

I tried that but I still get exactly the same error.

It’s actually when I try “ionic platform add android” that I get the error, not when I try to build it. If that makes any difference.


I’ve reinstalled the SDK with Eclipse and got all the components.

Now after “ionic platform add android” I get this error (after it appears that it’s working):

Error: Please install Android target “android-19”.
Hint: Run “android” from your command-line to open the SDK manager.

Typing android at the command-line just gives a “command not found error”.


Navigate to your sdk/tools folder and type

android sdk

This will open the SDK manager and then you can install everything for API 19.


So I’m added the android 19 in the SDK manager. That seems okay and the I can “add android” now.

I tried to “build” and I get a new error - ant is not installed.

Is this supposed to be this convoluted?


I don’t think it’s supposed to be this convoluted, but I run into new issues all of the time.

If you type “ant -version” into the command line does it give you a version?


I get the old “ant: command not found”.

I’m looking into installing ant now. It seems… complex.


Check out this post on stackoverflow. There are quite a few ways to install it but I think “brew install ant” worked for me.


Finally got it working, emulating on iOS and testable -debug.apk on my Android.


At last - time to do some actual development.


I’ve got a new(ish) problem.

In the test app folder (myApp) everything worked fine.

Now I’ve downloaded a project someone else has been working on (from GitHub) and put that in the same folder as the myApp folder. I should state that this other project (myBook) works fine if you use PhoneGap Build with the GitHub repository and it opens and runs fine in the browser. It works fine with ionic serve too.

But once again - I’m getting the:

“Error: ANDROID_HOME is not set and “android” command not in your PATH. You must fulfill at least one of these conditions.”

If I go to the myApp folder and try “ionic platform add android” I get told android is already added. If I run this in the myBook folder I get the android PATH error.

What have I done wrong? I realise I didn’t do “ionic start”, but that shouldn’t matter, should it?


Running ionic start wouldn’t matter, and PhoneGap build hosts the Android SDK on a cloud server so you don’t need it in your project folder. Where did you place the ANDROID_HOME declaration? Was it in your .bash_profile? I would try running through some of these.


Yes, it’s in the bash profile.

As I said in my previous posts itt - I did all that stuff and it was working fine. The ANDROID_HOME declaration is in the .bash_profile, yes.

It looks like this: ANDROID_HOME=~/Development/adt-bundle-mac/sdk

iOS build and emulation works fine btw.


Now I’m getting this:

"You must have bower installed to continue.
Type npm install -g bower (CLI v1.2.12)

add component name … Add a bower component to the project

I add it and when I try “ionic add platform android” I get it just says the same thing again:

"You must have bower installed to continue.
Type npm install -g bower (CLI v1.2.12)

add component name … Add a bower component to the project


I’m not sure if that is a typo or not but the command is “ionic platform add android” running “ionic add” tries to add a bower component to the project.

Available tasks: (use --help or -h for more info)

start … Starts a new Ionic project in the specified PATH
serve … Start a local development server for app dev/testing
platform … Add platform target for building an Ionic app
run … Run an Ionic project on a connected device
emulate … Emulate an Ionic project on a simulator or emulator
build … Locally build an Ionic project for a given platform
plugin … Add a Cordova plugin
package … Package an app using the Ionic Build service (beta)
upload … Upload an app to your Ionic account
lib … Gets Ionic library version or updates the Ionic library
setup … Configure the project with a build tool (beta)
service … Add an Ionic service package and install any required plugins
add … Add a bower component to the project
remove … Remove a bower component from the project
list … List bower components from the project


Yes, I’m actually using “ionic platform add android”.

It’s just that Android path again.


Can you try sourcing the .bash_profile and then try adding the platform again and see if it errors. It’s hard to troubleshoot without looking at it, but it is no longer recognizing your Android path.


Got it working.

I added “export” to the .bash_profile in front of ANDROID

What an annoying faff.


Anyone can help me with the following error:
i m getting this error while i m writing “ionic platform add android”