Error locating adb.exe when running Visual Studio 2015 RC and MS Android emulator
Asked Answered
S

3

12

I'm using VS 2015 RC, and I'm writing a cross platform mobile application. I have all the normal tools (java, android sdk, xamarin, cordova, etc.) installed and working. All the development is going well. I can debug just fine. Windows Phone 8.1 emulator run and debugs great. iOS simulator runs and debugs great.

When I try to run the MS Android Emulator (debug from VS), my project builds successfully (.apk gets created), and the Android emulator launches and starts the emulator OS just fine.

However, after the MS Android emulator starts, I get a pop up saying "Could not locate Android Debug Bridge (adb.exe)". My application never shows up on the emulator screen, and VS tells me deployment failed.

adb.exe is installed and working just fine (D:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe). I can go to command prompt, and execute it from anywhere (it's in my system PATH). ADB will work generically thru command prompt, detect devices, and everything just fine normally. It's only thru VS does it error out.

Where could VS be looking for adb.exe at? Could it be related to me choosing to install the Android SDK (including tools like adb.exe) on my D: drive (not my C:)?

enter image description here

Sverige answered 21/5, 2015 at 23:27 Comment(7)
If you do: 'Tools->Android->Android Adb Command Prompt...' - does the adb work from there? If not - check the %PATH% (it appends VS's adb path to the path of that command prompt). If it's incorrect, that might provide some useful information.Timehonored
'Tools->Android->Android Adb Command Prompt...' doesn't work either. I get a VS error msg, literally saying "Command did not execute successfully due to an unexpected exception." My %PATH% has the path to the adb.exe that got installed with the Android SDK install. What is "VS's adb path" that gets added to my %PATH%? How do I see that path?Sverige
%PATH% is the environment variable... But if you don't get the prompt, it doesn't matter. I would just try installing to the default path, and see if that fixes it.Timehonored
I understand %PATH%, but I thought you were saying that VS added another directory to my existing %PATH% dynamically somehow or something. Nevertheless, thank you for your help. I might try to install Android SDK on C: drive, just to see if VS will find adb.exe.Sverige
What I meant was, it will add the path to adb.exe in the %PATH% of the command window that option creates, but, if it's not launching it... Then that doesn't help.Timehonored
Steve, Did you check the ADT_Home Environment Variables? They are located at Tools > Options > Tools for Apache Cordova > Environment Variable Overrides. The ADT_Home location is usually "C:\Program Files (x86)\Android\android-sdk" However, since yours is in a different location, I believe you need to change. Note: ADB is part of the android-sdk folder.Bullfighter
Yeah. The ADT_HOME seemed set correctly. It was set to my Android sdk directory, on my D drive. The adb.exe was in there (platform-tools).Sverige
P
26

Visual Studio uses a registry key to identify where the Android SDK is installed. Go to Run > regedit and navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Android SDK Tools. The "Path" entry is what VS uses to find the SDK, so you may need to modify it to match where your SDK is installed. Also make sure that your android-sdk folder has \platform-tools\adb.exe

Proffitt answered 28/5, 2015 at 2:43 Comment(4)
In case you don't see the entry in the registry, just create one.Kurtz
This solved it for me. VS lets you change the default location of the sdk in the tools->options->Cross Platform. But apparently not everything picks this up.Gunar
Note that if you put a / at the end of the path of this registry key value, it won't work. Should be like this C:\ProgramData\Microsoft\AndroidSDK\25Ropable
This worked for me, but I just ended up with the next problem. "Unable to start debugging. Unable to connect to the device/emulator through the Android Debug Bridge (adb). If the problem continues, try restarting the device/emulator or resetting adb"Duress
W
1

A similar error exists in VS2019. To fix that:

1) Visit Android's Dev Studio site

2) Scroll past all the Studio stuff, that's gigs of stuff you don't need - click Download Options and skip to the "Command Line Tools only" - download that

3) Wherever you unzip its contents, navigate to the tools\bin folder inside and open a Command Prompt there.

4) Run sdkmanager platform-tools

5) Give it a minute.

You've now got adb.exe on your machine. It's going to be sitting inside a folder like C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe. Wherever it is, go open your Xamarin app and double-click the error complaining it can't find adb.exe. One last curve ball: In the above path, Visual Studio wants you to pick the folder named android-sdk. That is, not the platform-tools folder, which contains adb.exe, but, the folder above that, that contains the platform-tools folder.

Walloon answered 27/7, 2019 at 1:39 Comment(0)
C
-1

I had this problem in Windows. Executing Android Studio as Administrator solved it.

Cobwebby answered 9/3, 2018 at 17:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.