Search code examples
androidpathadb

adb is not recognized as internal or external command on windows. I can only use adb when i am in the android sdk


I get this error message

adb is not recognized as internal or external command on windows.

I think it's something with the path but I have added the path to the environment variable. I have:

Variable:ANDROID_HOME

Value: C:\Users\XXXX\AppData\Local\Android\sdk

Variable: ANDROID_HOME/platform-tools

Value: C:\Users\XXXX\AppData\Local\Android\sdk\platform-tools

Variable: ANDROID_HOME/tools

Value: C:\Users\XXXX\AppData\Local\Android\sdk\tools

Solution

  • There is a variable Path aswell, with values separated by ;.

    This is the only variable that matters when Windows tries to find an executable without the absolute path to the file given.

    For example, if your current path looks like

    C:\Some\Folder;C:\Some\Other\Folder;D:\My\Directory
    

    just add another entry to the end (or the beginning) like

    C:\Some\Folder;C:\Some\Other\Folder;D:\My\Directory;C:\Users\XXXX\AppData\Local\Android\sdk
    

    Then you should be able to find all .exe files in that sdk folder. Don't forget that you have to restart your command line (or whatever tool you want to use adb from) after editing the variables for that to take effect.

    You can also reuse your existing variables in the path:

    C:\Some\Folder;C:\Some\Other\Folder;D:\My\Directory;%ANDROID_HOME%
    

    You can add new entries to the end, at the beginning or somewhere in the middle - that influences the order in which Windows checks the folders to find the exe. When there is only one folder containing your .exe, the order does not matter.