433

I am trying to run google map v2 on emulator, I am following this tutorial. When I was trying to install required apk file on emulator, I am getting below error.

I tried to solve this using this tutorial.Followed all steps, added the path to paltform-tools to environment path. Also after modifying the PATH variable started a new CommandPrompt window.

But getting the same error. I need to check my google map application on emulator. Kindly suggest me.

'adb' is not recognized as an internal or external command,
operable program or batch file.

enter image description here

0

30 Answers 30

367

Set the path of adb into System Variables. You can find adb in "ADT Bundle/sdk/platform-tools" Set the path and restart the cmd n then try again.

Or

You can also goto the dir where adb.exe is located and do the same thing if you don't wanna set the PATH.

If you wanna see all the paths, just do

echo %PATH%
7
  • 14
    Thank you .. set the path to system variables works , i was adding to user variables.
    – Nibha Jain
    Commented Dec 13, 2013 at 11:12
  • 4
    "restart the cmd " works for me. I was checking just adding path without restart.
    – Manju
    Commented Oct 15, 2016 at 18:50
  • 16
    no need to restart cmd like such: PATH %PATH%;E:\Android\sdk\platform-tools
    – Leo Lee
    Commented Jun 14, 2017 at 6:13
  • 83
    find adb here: "USERNAME/AppData/Local/Android/sdk/platform-tools"
    – hmac
    Commented Oct 12, 2017 at 9:35
  • 1
    if you just added a path variable, you may not see the the path just added. try signing out and signing again and recheck. Commented Sep 5, 2019 at 13:16
342

From Android Studio 1.3, the ADB location is at:

C:\Users\USERNAME\AppData\Local\Android\sdk\platform-tools.

Now add this location to the end of PATH of environment variables. Eg:

;C:\Users\USERNAME\AppData\Local\Android\sdk\platform-tools
4
  • 6
    After we got adress, to add path in windows we should type in cmd: path C:\Users\USERNAME\AppData\Local\Android\sdk\platform-tools
    – Choletski
    Commented Jan 9, 2021 at 9:21
  • 1
    Thankyou Vamsi sir, I am very grateful that you , this error is solved with this step Commented Jan 18, 2021 at 18:14
  • 9
    If you change the path to this %USERPROFILE%\AppData\Local\Android\sdk\platform-tools it's copyable for everyone and will work the same.
    – Nick N.
    Commented Jun 25, 2021 at 9:34
  • 3
    Don't know why, but in my case restart was needed as well.
    – s3c
    Commented Nov 26, 2021 at 7:36
155

If you want to use it every time add the path of adb to your system variables: enter to cmd (command prompt) and write the following:

echo %PATH%

this command will show you what it was before you will add adb path

setx PATH "%PATH%;C:\Program Files\android-sdk-windows\platform-tools"

be careful the path that you want to add if it contains double quote

after you restart your cmd rewrite:

echo %PATH%

you will find that the path is added

PS: if you just want to add the path to cmd just to this session you can use:

set PATH=%PATH%;C:\Program Files\android-sdk-windows\platform-tools
6
  • 3
    Just a detail, remember to restart Android Studio after you set the %PATH% to your system. This solution should work as @Chris Sim suggested.
    – CBA110
    Commented Sep 22, 2015 at 17:57
  • 2
    It deleted all my environment variables of Path. how can I bring them back?
    – Darush
    Commented Aug 31, 2017 at 15:03
  • 2
    If you ussetx PATH "%PATH%;C:\Program Files\android-sdk-windows\platform-tools" the old path will not be deleted!! , %PATH% is the old path that u already have, then you add you local path
    – Chris Sim
    Commented Sep 5, 2017 at 11:06
  • 1
    there are possibility that path can be truncated to 1024 characters if you use setx via command line like this. I prefer use control panel forms in windows to edit paths
    – Dika
    Commented Sep 30, 2019 at 15:22
  • For proper workability command line should be launched as Administrator.
    – Yazon2006
    Commented Oct 2, 2019 at 6:59
118

I did this on Windows 7, by going to:

Start > Control Panel > System > Advanced System Settings > Environment Variables...

In this Environment Variables window, in the User variables for (your-username) highlight Path and click Edit...

You then need to append a ; if there isn't already one at the end of the Variable value field, and then append C:\Users\<your-username>\AppData\Local\Android\sdk\platform-tools; to that same field.

Then click the three OK buttons to get out.

If you already have a Command Prompt window open, close it then re-open and the adb devices command should then work.

1
  • 5
    In my case, this one works when I set it to the one in System Variables Commented Sep 5, 2019 at 7:14
52

In Windows 10,

  1. Add User Variable PATH: %USERPROFILE%\AppData\Local\Android\sdk\platform-tools.
  2. Restart cmd (if any open).
  3. adb devices, it should list, if it does, you are all set.

That's it!

3
  • This ^ It has to be in the User Path, not the System Path.
    – Leo
    Commented May 12, 2019 at 10:21
  • 1
    I think this is the clearest & least error-prone answer on this thread. should be the accepted answer
    – Dika
    Commented Sep 30, 2019 at 15:20
  • 1
    Restart cmd is important..+1
    – peiman F.
    Commented Oct 17, 2020 at 11:41
48

On Window, sometimes I feel hard to click through many steps to find platform-tools and open Environment Variables Prompt, so the below steps maybe help

Step 1. Open cmd as Administrator

Step 2. File platform-tools path

cd C:\
dir /s adb.exe

Step 3: Edit Path in Edit Enviroment Variables Prompt

rundll32 sysdm.cpl,EditEnvironmentVariables

more, the command to open environment variables can not remember, so I often make an alias for it (eg: editenv), if you need to work with environment variables multiple time, you can use a permanent doskey to make alias

Step 4: Restart cmd

1
  • Step 4: Restart computer - in my case helped. Thanks for good instruction!
    – walkmn
    Commented Sep 2, 2022 at 8:33
36

Add your path into environment variable "PATH" where you installed your sdk with below:

\Sdk\platform-tools

You can in image below for example:

enter image description here

and reopen your command prompt to see changes.

1
  • 9
    --> andorid 🤔
    – Leo
    Commented May 2, 2019 at 15:58
34

Follow path of you platform tools folder in android setup folder where you will found adb.exe

D:\Software\Android\Android\android-sdk\platform-tools

Check the screenshot for details

enter image description here

1
  • 1
    I just found Android Studio folder in Android no android-sdk folder found why?
    – Majedur
    Commented Jan 20, 2019 at 5:24
16

enter image description here

For environment variable, we have to need to follow some steps.

16

If your OS is Windows, then it is very simple. When you install Android Studio, adb.exe is located in the following folder:

C:\Users\**your-user-name**\AppData\Local\Android\Sdk\platform-tools

Copy the path and paste in your environment variables.

Open your terminal and type: adb it's done!

15

adb command can be under the new path below- C:\Users\USERNAME\AppData\Local\Android\sdk\platform-tools for new versions of Android studio. I found in this location for me.

15

You will need to set the PATH variable pointing to the directory where adb.exe is to be found. If you are using cmd.exe, this command will help:

set PATH=%PATH%;%USERPROFILE%\appdata\Local\Android\sdk\platform-tools
12

In new version PowerShell, after all steps that mentioned before this, please attend:

before

adb

now

.\adb
10

just open Android studio and press "Tools" on Top navigation bar

tools->SDK Manager

Where you can get SDK location

Open SDK folder -> platform-tools

9

I recommand you using PowerShell

Set Android Studio Terminal to PowerShell:

Settings > Tools > Terminal > Shell path = pwsh.exe (instead of cmd.exe)

Open Terminal on Android Studio

PowerShell 7.0.1
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/powershell
Type 'help' to get help.

PS >

Test the path for adb.exe

# `pikachu` should be replace your username
PS > test-path "C:\Users\pikachu\AppData\Local\Android\sdk\platform-tools"
True

Open your powershell profile file in your text editor

PS > notepad $profile

add below line, save and exit

# `pikachu` should be replaced with your username
$env:PATH+=";C:\Users\pikachu\AppData\Local\Android\sdk\platform-tools"

re-open Terminal and try adb

PS > adb
Android Debug Bridge version 1.0.41
Version 30.0.1-6435776
Installed as C:\Users\hdformat\AppData\Local\Android\sdk\platform-tools\adb.exe

global options:
 -a         listen on all network interfaces, not just localhost
 -d         use USB device (error if multiple devices connected)
 -e         use TCP/IP device (error if multiple TCP/IP devices available)
 -s SERIAL  use device with given serial (overrides $ANDROID_SERIAL)
 -t ID      use device with given transport id
 -H         name of adb server host [default=localhost]
 -P         port of adb server [default=5037]

2
  • 2
    cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
    – Mori
    Commented May 16, 2022 at 17:42
  • This is so close... I had to add a semicolon before my path: ``` $env:PATH+=";C:\Users\pikachu\AppData\Local\Android\sdk\platform-tools" ```
    – phreakhead
    Commented Sep 9, 2022 at 18:00
8

1st: goto the drive where your eclipse reside and goto sdk and platform tool in my case C:\adt-bundle-windows-x86_64-20140702\sdk\platform-tools

2nd:copy that address for ease of access

enter image description here

3:open command prompt win+r and type cmd hit enter

4:paste the address in cmd and hit enter thats all

enter image description here

7

Since I installed version 1.0.41,

I had to use the command "adb version" instead of "adb –version", in Windows 10.

enter image description here

Check and add these below loacations to the path variable:

C:\Users\Sameera\AppData\Local\Android\Sdk\tools
C:\Users\Sameera\AppData\Local\Android\Sdk\platform-tools
C:\Users\Sameera\AppData\Local\Android\Sdk\build-tools

ANDROID_HOME
C:\Users\Sameera\AppData\Local\Android\Sdk

Also adb version command worked for Mac OS as well.

1
6

Based on Vamsi Tallapudis earlier answer I came up with this dynamic path:

%LOCALAPPDATA%/Android\sdk\platform-tools

It's using a Windows Environment Variables. I find this solution to be both elegant and easy and would therefor like to share it.

4

I had same problem when I define PATH below

C:\Program Files (x86)\Java\jre1.8.0_45\bin;C:\dev\sdk\android\platform-tools

and the problem solved when I bring adb root at first.

C:\dev\sdk\android\platform-tools;C:\Program Files (x86)\Java\jre1.8.0_45\bin
4

This is where I found it:

C:\Users\<USER>\AppData\Local\Android\sdk\platform-tools

I had to put the complete path into the file explorer. I couldn't just click down to it because the directories are hidden.

I found this path listed in Android studio:

Tools > Android > SDK Manager > SDK Tools

3

In my case it was:

C:\Program Files (x86)\Android\android-sdk\platform-tools
3

This answer assumes that the PATH has been correctly set as described in the other answers.

If you're on Windows 10 and don't have Admin rights, then right click on the CMD, powershell ... program and select run as administrator. Then try adb [command]

2

First select drive that is where Android sdk folder is there. Then you Follow the below steps

cd DriveName:/ or Ex : cd c:/ Press 'Enter'

then you will give the path that is adb console path is there in a platform-tools folder so cd Root Folder/inner root folder if there/Platform-tools Press 'Enter' then it selects the adb directory.

2

If you didn't set a path for ADB, you can run .\adb instead of adb at sdk/platformtools.

2

It seems that Avast antivirus detects adb.exe as a virus and adds it to it chest

2

Step 1

In android studio. Go to File > Setting > Languages & Frameworks > Android Studio > SDK Tools

Install

  • Android SDK Command-line Tools (latest)
  • Android SDK Platform-Tools
  • Google USB Driver

Step 2

Go to windows search bar and search edit the system environment variables

Now click Environment Variables

Select path in user variables and press edit

Now, create a new path. Your path will be C:\Users\USERNAME\AppData\Local\Android\sdk\platform-tools

Step 3

Now, re-open the cmd window. and run the adb devices command.

0
1

For those using macOS, this osxdaily.com article shows several ways to add adb to the $PATH.

Here's the one I prefer:

  1. Add a file named adb to /etc/paths.d/ folder that just contains the path to adb's location: /Users/YourUserName/Library/Android/sdk/platform-tools/

    In a Terminal window, sudo vim /etc/paths.d/adb
    -> enter the path and save the file.

  2. Close/re-open Terminal in order for it to see the change.

1

For windows

You can open the Environment Variables window by pressing the Windows key + R and then typing "SystemPropertiesAdvanced" and pressing Enter. On the Advanced tab, click the "Environment Variables" button.

after that click on path and paste path of adb

1

Add in Environment Variables new path

%USERPROFILE%\AppData\Local\Android\sdk\platform-tools
0

You could just drag the adb.exe on to the command prompt from sdk/platformtools and leave a space and type the command you want: like logcat.

It looks like this for me:

C:\adt-bundle-windows-x86-20130917\adt-bundle-windows-x86-20130917\sdk\platform-tools.exe logcat

and hit enter.

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