Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am MAC OS X Yosemite I have done all the export tutorial to set the android_home but non of it working for me

like image 491
CMP Avatar asked Nov 02 '14 15:11

CMP


People also ask

What is Android_home path?

ANDROID_HOME. Sets the path to the SDK installation directory.

How do I find my Android SDK path?

by default, the "Android Studio IDE" will be installed in " C:\Program Files\Android\Android Studio ", and the "Android SDK" in " c:\Users\username\AppData\Local\Android\Sdk ".


3 Answers

Making sure ANDROID_HOME is exported and adding the SDK tool directories to PATH should be more than enough to get you going.


Using the terminal

# First, we make sure we have a newline at the end of the .bash_profile
echo >> /Users/abdi/.bash_profile

# We set the ANDROID_HOME value in the .bash_profile
echo "export ANDROID_HOME=/Users/abdi/adt/sdk" >> /Users/abdi/.bash_profile

# We alter the PATH value a bit as well
echo "export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools" >> /Users/abdi/.bash_profile

# We then tell the terminal to update all the things
. /Users/abdi/.bash_profile

Using a GUI (mostly)

You can also open the .bash_profile file in TextEdit using the open -e /Users/abdi/.bash_profile command. If you get some errors about missing files, try running touch /Users/abdi/.bash_profile and retry the open command. In the file that opens, add the following lines at the end.

export ANDROID_HOME=/Users/abdi/adt/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

Running . /Users/abdi/.bash_profile as in the terminal version after that should get you fully set up.

like image 93
Valter Jansons Avatar answered Nov 10 '22 09:11

Valter Jansons


First need to set the ANDROID_HOME directory look into your android-sdk-linux(mac) directory and look for 'android' executable file, generally it will exists under 'tools' directory

so edit your .bashrc from home folder

and add this line down there

export ANDROID_HOME=~/android-sdk-linux
PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

Once done, exit your console and run your command again

You could expect an error saying " Please install Android target "android-19" " if it is not set yet.

you may fix that running "android" command and selecting "Android 4.4.2 API 19" to install.

And afterwards, don't forget to give ample permission to directory where the application resides.

like image 38
Code Tree Avatar answered Nov 10 '22 09:11

Code Tree


I had the same problem. Luckily it is easily fixable. Just follow the next few steps (Command-line from terminal).

  1. Open the bash_profile file using command line arguments with -

    vi ~/.bash_profile

OR

It is possible to open bash_profile in TextEdit and make changes there. Use the following command to do this -

open -a "TextEdit" .bash_profile

  1. Check if ANDROID_HOME has been set in this file. If it has been already set, delete it (probably wrong). Also check if PATH in this file has any reference to tools or platform-tools (of the android sdk). You'd be better off deleting these before you start typing the following commands.

  2. Set ANDROID_HOME correctly using the following command export ANDROID_HOME=/Users/adarsh/android-sdk-macosx

^this is my command because I installed it in that location. Please replace "adarsh" with your username and "android-sdk-manager" with the name of your android sdk folder that you downloaded. Do not copy-paste this command.

For example, if your username is "John" and you the android sdk folder you downloaded and installed is in "Downloads" and you changed your folder name to "sdk", then your command would be -

export ANDROID_HOME=/Users/John/Downloads/sdk

  1. Set PATH with the following command

    export PATH=$ANDROID_HOME/tools:$PATH

  2. Refresh your bash_profile to set all the changes we just made by typing the command

    source ~/.bash_profile

You should be good to go now and begin developing with ionic!Hope this helps. Cheers.

like image 20
mutp Avatar answered Nov 10 '22 08:11

mutp