Unable to locate adb when using Android Studio

Solution 1:

Finally after several hours of investigation I think I have another solution for everyone having issues with AVD Manager "Unable to locate adb".

I know we have the setting for the SDK in File -> Settings -> Appearance & Behavior -> System Settings -> Android SDK. This it seems is not enough! It appears that Android Studio (at least the new version 4) does not give projects a default SDK, despite the above setting.

So, you also (for each project) need to go to File -> Project Structure -> Project Settings -> Project, and select the Project SDK, which is set to [No SDK] by default.

If there's nothing in the drop-down box, then select New, select Android SDK, and navigate to your Android SDK location (normally C:\Users[username]\AppData\Local\Android\Sdk on Windows). You will then be able to select the Android API xx Platform. You now should not get this annoying adb error.

HTH

Solution 2:

I fixed this problem by installing SDK from SDK Manager in Andoid Studio.

screenshot

Solution 3:

Update: On versions of macOS > 10.15.x (Catalina), the file to use is: ¨/.zshrc as Apple switched to ZSH as the default login-shell starting with 10.15.

---- Original Answer Follows + small adjustments for clarity ----

This worked for me, on my Mac.
Install platform-tools, and update your $PATH environment variable:

Using your text editor of choice:

nano ~/.zshrc    # ~/.bashrc for macOS < 10.15

Edit existing PATH or add the following:

export PATH="$PATH:[PLATFORM-TOOLS-PATH-HERE]"

Save the file and refresh Zsh's configuration:

source ~/.zshrc    # (~/.bashrc if macOS < 10.15) Or zsh -l to re-read login scripts

Hope this helps.