The question:
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.
The Solutions:
Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.
Method 1
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%
Method 2
From Android Studio 1.3, the ADB location is at:
C:UsersUSERNAMEAppDataLocalAndroidsdkplatform-tools.
Now add this location to the end of PATH of environment variables. Eg:
;C:UsersUSERNAMEAppDataLocalAndroidsdkplatform-tools
Method 3
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 Filesandroid-sdk-windowsplatform-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 Filesandroid-sdk-windowsplatform-tools
Method 4
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>AppDataLocalAndroidsdkplatform-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.
Method 5
In Windows 10,
- Add User Variable PATH:
%USERPROFILE%AppDataLocalAndroidsdkplatform-tools
. - Restart
cmd
(if any open). adb devices
, it should list, if it does, you are all set.
That’s it!
Method 6
Add your path into environment variable “PATH” where you installed your sdk with below:
Sdkplatform-tools
You can in image below for example:
and reopen your command prompt to see changes.
Method 7
Follow path of you platform tools folder in android setup folder where you will found adb.exe
D:SoftwareAndroidAndroidandroid-sdkplatform-tools
Check the screenshot for details
Method 8
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
Method 9
adb command can be under the new path below-
C:UsersUSERNAMEAppDataLocalAndroidsdkplatform-tools
for new versions of Android studio.
I found in this location for me.
Method 10
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**AppDataLocalAndroidSdkplatform-tools
Copy the path and paste in your environment variables.
Open your terminal and type: adb
it’s done!
Method 11
For environment variable, we have to need to follow some steps.
Method 12
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
Method 13
1st: goto the drive where your eclipse reside and goto sdk and platform tool in my case C:adt-bundle-windows-x86_64-20140702sdkplatform-tools
2nd:copy that address for ease of access
3:open command prompt win+r and type cmd hit enter
4:paste the address in cmd and hit enter thats all
Method 14
Based on Vamsi Tallapudis earlier answer I came up with this dynamic path:
%LOCALAPPDATA%/Androidsdkplatform-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.
Method 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%appdataLocalAndroidsdkplatform-tools
Method 16
I had same problem when I define PATH below
C:Program Files (x86)Javajre1.8.0_45bin;C:devsdkandroidplatform-tools
and the problem solved when I bring adb root at first.
C:devsdkandroidplatform-tools;C:Program Files (x86)Javajre1.8.0_45bin
Method 17
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:UserspikachuAppDataLocalAndroidsdkplatform-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:UserspikachuAppDataLocalAndroidsdkplatform-tools"
re-open Terminal and try adb
PS > adb
Android Debug Bridge version 1.0.41
Version 30.0.1-6435776
Installed as C:UsershdformatAppDataLocalAndroidsdkplatform-toolsadb.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]
Method 18
Since I installed version 1.0.41,
I had to use the command "adb version"
instead of "adb –version"
, in Windows 10.
Check and add these below loacations to the path variable:
C:UsersSameeraAppDataLocalAndroidSdktools
C:UsersSameeraAppDataLocalAndroidSdkplatform-tools
C:UsersSameeraAppDataLocalAndroidSdkbuild-tools
ANDROID_HOME
C:UsersSameeraAppDataLocalAndroidSdk
Method 19
In my case it was:
C:Program Files (x86)Androidandroid-sdkplatform-tools
Method 20
This is where I found it:
C:Users<USER>AppDataLocalAndroidsdkplatform-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
Method 21
This answer assumes that the PATH has been correctly set as described in the other answers
If you’re on Windows 10 and dont have Admin rights then right click on the CMD, powershell … program and select run as administrator. Then try adb [command]
Method 22
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.
Method 23
If you didn’t set a path for ADB, you can run .adb
instead of adb
at sdk/platformtools
.
Method 24
It seems that Avast antivirus detects adb.exe
as a virus and adds it to it chest
Method 25
For those using macOS, this osxdaily.com article shows several ways to add adb
to the $PATH.
Here’s the one I prefer:
-
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. -
Close/re-open Terminal in order for it to see the change.
Method 26
In new version PowerShell
, after all steps that mentioned before this, please attend:
before
adb
now
.adb
Method 27
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-20130917adt-bundle-windows-x86-20130917sdkplatform-tools.exe logcat
and hit enter.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0