Error:Unable to locate adb within SDK in Android Studio

318,055

Solution 1

The ADB is now located in the Android SDK platform-tools.

  1. Check your [sdk directory]/platform-tools directory and if it does not exist, then open the SDK manager in the Android Studio (a button somewhere in the top menu, android logo with a down arrow), switch to SDK tools tab and and select/install the Android SDK Platform-tools.

enter image description here enter image description here enter image description here

  1. Alternatively, you can try the standalone SDK Manager: Open the SDK manager and you should see a "Launch Standalone SDK manager" link somewhere at the bottom of the settings window. Click and open the standalone SDK manager, then install/update the

"Tools > Android SDK platform tools".

  1. If the above does not solve the problem, try reinstalling the tools: open the "Standalone SDK manager" and uninstall the Android SDK platform-tools, delete the [your sdk directory]/platform-tools directory completely and install it again using the SDK manager.

  2. Check your antivirus chest. Sometimes the Antivirus program thinks adb.exe is a virus. If you find it there please restore the file and it will start working. You can also put adb.exe as a safe file in you Antivirus program.

enter image description here enter image description here

Hope this helps!

Solution 2

In my case I had no SDK selected for my project(not sure why). Simply went to Project Structure dialog (alt+ctrl+shift+s or button 1 on the screen) and then to project-> Project SDK's was selected <no SDK>. Just changed it to the latest

Project Structure dialog

Solution 3

For anyone who is still running into this issue. I had a similar problem where I could see my device from adb on the command line using adb devices but Android Studio would not recognize when I had a device attached and would throw either:

  • Unable to locate adb within SDK or
  • Unable to obtain result of 'adb version'

    I had tried start/stops of adb, uninstalls, of platform-tools, and more. What I found was that inside my C:\Users\<UserName>\AppData\Local\Android folder I had multiple sdk folders. I performed the following:

    1. Unistall Platform-Tools using Android Studio's SDK Manager
    2. Deleted all platform-tools\ directories within each C:\Users\<UserName>\AppData\Local\Android\sdk* directory
    3. Reinstalled Platform-Tools using Android Studio's SDK Manager

Hope this helps someone someday with their issue.

Solution 4

If you are using Android Studio and have AVG virus protection, the adb.exe file might be in the Virus Vault. This was my problem. To fix: Open AVG. Select Options (top right), then Virus Vault. If you see the adb.exe file in there, select it and then click Restore.

Solution 5

In Android Studio, Click on 'Tools' on the top tab bar of android studio

Tools >> Android >> SDK Manager >> Launch Standalone Sdk manager

there you can clearly see which platform tool is missing , then just install that and your adb will start working properly.

Fully install at-least one Api package (Android Api 23 or 24) .

Share:
318,055
SleepsOnNewspapers
Author by

SleepsOnNewspapers

iOS and Android developer

Updated on February 08, 2022

Comments

  • SleepsOnNewspapers
    SleepsOnNewspapers over 2 years

    Does anyone know what this means? When I click the "run" button on my simulator I get this message.

    Throwable: Unable to locate adb within SDK

    I am running the latest version, 0.8.14.

  • SleepsOnNewspapers
    SleepsOnNewspapers over 9 years
    so you think there's something wrong with my sdk location?
  • Vladislav Kan
    Vladislav Kan over 9 years
    Yes, i think so. try to open sdk manager and also install all the plugins
  • IberoMedia
    IberoMedia almost 8 years
    C:\Users\myusername\AppData\Local\Android\sdk\platform-tools
  • SuperHaker
    SuperHaker about 7 years
    Can confirm this to happen in Avast.
  • Greg
    Greg over 6 years
    I can't actually even see adb.exe in the separate SDK download (windows)?
  • Desolator
    Desolator over 6 years
    @Greg - you need to download platform-tools from the link above then place it in the above directory. restart your android studio and it should work
  • Greg
    Greg over 6 years
    oh, ok so I'd downloaded the separate "sdk tools" not "platform tool" - thanks
  • Desolator
    Desolator over 6 years
    @Greg - sounds like it's a different issue
  • Greg
    Greg over 6 years
    Yep :) Not sure why Android Studio with Platform Tools selected/downloaded didn't have it, but got it now
  • M.ArslanKhan
    M.ArslanKhan about 6 years
    yes, it also happens in Avast. Go to Protection>Virus chest> check the required checkbox adb.exe>click drop down on delete>restore>restart Android Studio
  • tobi512
    tobi512 about 4 years
    Just hit the same problem on CI-environment (Bitrise.io), thanks for pointing it out! Could be a recent change in v29.0.6 of the platform tools.
  • fikkatra
    fikkatra almost 4 years
    In my case I had only a single SDK folder, but uninstalling and re-installing Platform-Tools worked for me
  • EpicVoyage
    EpicVoyage almost 4 years
    In my case, I had not selected a project SDK. N00b mistake. This got me onto the right path. Thanks!
  • Aaron Elliot
    Aaron Elliot over 3 years
    This fixed my issue for me! It was a flutter project.
  • Stacky
    Stacky over 3 years
    As of Android Studio 4, you might also need to set an SDK for the project since the IDE does not seem to do this on its own.
  • Luc Bloom
    Luc Bloom about 3 years
    I updated Android Studio (April 2021) and now there's a separate category called "Android SDK Command-line Tools". I installed those, restarted Android Studio and now it's working again.
  • Däñish Shärmà
    Däñish Shärmà about 3 years
    nhi kaam kia bhai
  • Hesham Eraqi
    Hesham Eraqi almost 3 years
    This fixed the issue for me. Thank you.
  • anandhu
    anandhu over 2 years
    HEY FLUTTERORS... try this solution!
  • Shubhanu Sharma
    Shubhanu Sharma over 2 years
    Where are Project SDK settings in Android studio 11? Couldn't find it.
  • ElSheikh
    ElSheikh over 2 years
    Thanks a lot, this was a lifesaver, I tried on Windows 11 and it is working fine the path for cmdline-tools the path might be looking like C:\Users\<USER-NAME>\AppData\Local\Android\Sdk\cmdlines-tool
  • Scott Deagan
    Scott Deagan over 2 years
    People experiencing this issue should definitely check this first.