I am using Ubuntu 14.04 Trusty Tahr, and I downloaded Android Studio with the umake tool provided by Ubuntu. This downloaded Android Studio at /root/tools/android/android-studio, and platform-tools and all other tools at - /root/Android/Sdk/

Android Studio on my PC is working just fine, and I am able to create an application and also run it on my mobile phone using it. But I want command line access to the tools and so I want to add them to the environment path.

To add them to environment path, I did this-

nano ~/.bachrc

And added the following lines-

 export PATH=${PATH}:/root/Android/Sdk/platform-tools
 export PATH=${PATH}:/root/Android/Sdk/build-tools

But this dosen't work. When I give the command adb from a terminal, it dosen't seem to invoke the adb tools from the platform-tools folder. Instead it tells me to install android-tools-adb.

I am however being able to cd into platform-tools, and run adb and other tools from there, but I don't want to do that again and again. Also, how can I add Android Studio to my PATH so that I don't have to cd into its bin/ directory again and again?

Thank you very much in advance.

  • What say which adb and which -a adb? – Karl Richter Jul 26 '15 at 19:46

This worked for me

export PATH=$PATH:$HOME"/android-sdk-linux/platform-tools"
| improve this answer | |

If you install Android SDK through Android Studio (or any other way that put you Android SDK folder under this path), execute this line:

export PATH=$PATH:$HOME"/Android/Sdk/platform-tools"
| improve this answer | |

I added this line to the bottom of my .bashrc and it works.

export PATH=/home/[myusername]/android-sdk-linux/platform-tools:$PATH

source ~/.bashrc  #To update the bashrc with the changes in the current tab

I don't understand the PATH=${PATH} syntax in your example, so I can't comment on whether it's correct or not, but you could try the syntax I used.

| improve this answer | |
  • 1
    PATH=$PATH:[path to add] means that the path will be appended at the end to the original Path-variable. You used PATH=[path to add]:$PATH, what means that the path will be appended before the Path-variable. – Alex Leidwein Aug 27 '17 at 21:08

I installed Android Studio via snap. So I had to add the platform-tools folder path to the .bashrc file.

  1. If you use visual studio code as editor type this in the terminal

    code ~/.bashrc

  2. It will open the visual studio code and the .bashrc file is opened in it. Go to the bottom of the file and add the following export,

    # Android Path
    if [ -d "$HOME/Android/Sdk/platform-tools" ] ; then
     export PATH="$HOME/Android/Sdk/platform-tools:$PATH"

Note: Leave and empty line at the end of .bashrc file. So the shell program knows it is the end of file (EOF).

Saved the .bashrc file and quit visual studio code

Go to Terminal and source the updated .bashrc file

source ~/.bashrc
| improve this answer | |

There are 2 common ways to set your PATH environment variable in ~/.bashrc. We may mess them up (I did).

  • Method 1: export PATH="~/Android/Sdk/platform-tools:$PATH"
  • Method 2: PATH=~/Android/Sdk/platform-tools:$PATH

The export method requires to put the PATH value between quotes and the second does not.

I recommend the second method - set the PATH variable directly - because we may not have to worried about quote(s).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.