Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: ANDROID_HOME is not set and "android" command not in your PATH on OS X

I am getting this error in terminal when attempting to execute this command:

$ cordova platform add android

I read these answers here:

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

ANDROID_HOME is not set and "android" command not in your PATH Phonegap

however I don't know where to place the code they provide.

I am running OS X.

like image 212
Peter Stuart Avatar asked Jan 12 '15 02:01

Peter Stuart


People also ask

How do I know if I have Android SDK installed on my Mac?

To determine where the Android SDK folder on your computer is located open Android Studio. Press the Android Studio menu in the toolbar and search for “Android SDK” or navigate there via Appearance & Behavior, System Settings, Android SDK.


1 Answers

Option 1

for windows

Right click on My computer -> properties -> Advanced system setting -> Environment Variables

Now Edit Path on system variables to

;/yourSdkHome/tools;/youSdkHome/platform-tools

Option 2

In Windows machine, Open Command prompt and enter each of this commands one by one

set ANDROID_HOME=**C:\\android-sdk-windows**

set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools

In MAC Machine, open Terminal and enter these one by one

export ANDROID_HOME=/<installation location>/android-sdk-macosx
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

Note - C:\\android-sdk-windows should be replaced by the path of Android SDK in your machine.

<installation location> should be replaced by the path of Android SDK in your machine.

Example

in MAC machine, if install location is ~/adt-bundle-mac-x86_64/sdk

first line should be

export ANDROID_HOME=~/adt-bundle-mac-x86_64/sdk
like image 155
Prem Avatar answered Nov 15 '22 07:11

Prem