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.”
Try and export the ANDROID_HOME var with the path to your SDK. in your bash_profile do this ANDROID_HOME=/Development/adt-bundle/sdk
then update your process with your new bash_profile by running source ~/.bash_profile in your current terminal window
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.
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
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.