0

I have my ADT folder at /Users/username/Development/adt-bundle-mac-x86_64-20140702/ and I am trying to set the bash_profile file to work with it because whenever I type "android" or "adb" into the terminal, it returns "-bash: android: command not found". Right now, my .bash_profile (which is stored at /Users/username/) looks like:

export PATH=$PATH:~/bin
export ANDROID_HOME=/Developer/adt-bundle-mac-x86_64-20140702/
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

After each time I update the file to try something else, I save it and then type "source .bash_profile" into the terminal to refresh the file. Is it possible that I should be using a command?

I have gone through numerous tutorials on Stack Overflow and other sites, but none of them are working.

Thanks in advance for the help

  • What do you see if you type `echo $PATH` ? Can you invoke those tools if you specify the full pathname of the executable, or might there be a permission issue or path typo as well? – Chris Stratton Jul 28 '14 at 18:45
  • @ChrisStratton Here's the output:`nicks-mbp:~ nick$ echo $PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/Users/nick/bin:/Developer/adt-bundle-mac-x86_64-20140702//tools:/Developer/adt-bundle-mac-x86_64-20140702//platform-tools` – user3785178 Jul 28 '14 at 18:47

2 Answers2

0

Your variable ANDROID_HOME doesn't match the path that you say your ADT folder is located at. Try changing it to:

export PATH=$PATH:~/bin
export ANDROID_HOME=/Users/username/Development/adt-bundle-mac-x86_64-20140702/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
neatnick
  • 1,489
  • 1
  • 18
  • 29
  • Oh, right. Duh. I changed ANDROID_HOME, but it still doesn't solve the problem. Here's the output when I echo the $PATH: `nicks-mbp:~ nick$ echo $PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/Users/nick/bin:/Users/nickstigsell/Development/adt-bundle-mac-x86_64-20140702//tools:/Users/nickstigsell/Development/adt-bundle-mac-x86_64-20140702//platform-tools` – user3785178 Jul 28 '14 at 18:54
  • Take out the backslash at the end of the `ANDROID_HOME` variable, and see if that does it. I've edited my answer – neatnick Jul 28 '14 at 18:56
  • I removed the trailing slash on line 2: but that doesn't work either. Here's the echo $PATH: `nicks-mbp:~ nick$ echo $PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/Users/nick/bin:/Users/nickstigsell/Development/adt-bundle-mac-x86_64-20140702/tools:/Users/nickstigsell/Development/adt-bundle-mac-x86_64-20140702/platform-tools` – user3785178 Jul 28 '14 at 18:57
  • I notice that your username seems to be different at different points in the path: `/Users/nick/bin` and `/Users/nickstigsell ...`. Which one is your home directory located at? – neatnick Jul 28 '14 at 18:59
  • It's located at "nick". I mistakenly typed "nickstigsell" because that's the directory name on my other computers. I've updated the ANDROID_HOME link but it still doesn't work. `nicks-mbp:~ nick$ echo $PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/Users/nick/bin:/Users/nick/Development/adt-bundle-mac-x86_64-20140702/tools:/Users/nick/Development/adt-bundle-mac-x86_64-20140702/platform-tools` – user3785178 Jul 28 '14 at 19:01
  • What is the output of `ls -l /Users/nick/Developm‌​ent/adt-bundle-mac-x86_64-20140702/platform-tools/adb` (or substitute whatever you put in your $PATH most recently) – Chris Stratton Jul 28 '14 at 19:03
  • 1
    Usually the way the adt-bundle is laid out there is a sdk/ folder that contains the commands you're looking for, try adding /sdk to the end of the `ANDROID_HOME` variable – neatnick Jul 28 '14 at 19:04
  • 1
    Yes, find the tools and test them with full paths from the command line, *then* update your path. – Chris Stratton Jul 28 '14 at 19:06
  • The output was that the file doesn't exist. I looked at the file path in Finder and then I realized that I was missing the /sdk directory. Therefore, this is the correct .bash_profile: `export PATH=$PATH:~/bin export ANDROID_HOME=/Users/nick/Development/adt-bundle-mac-x86_64-20140702/sdk export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools` – user3785178 Jul 28 '14 at 19:07
  • Is everything working now then? If so accept the answer so that people know the problem has been solved. – neatnick Jul 28 '14 at 19:20
0

Have you checked the shell you are using is ksh or bash? I had same problem but after changing from ksh to bash,it worked every time! refer this answer

Community
  • 1
  • 1
positivecrux
  • 1,307
  • 2
  • 16
  • 35