Sharon
Sharon

Reputation: 3919

Android Studio: "Unable to obtain result of 'adb version'"

I am presently unable to do app testing on Android Studio, and I don't know what to do next. I've been getting the error "Unable to obtain result of 'adb version'" when I try to run an emulator. I don't think I changed anything on my system to make it happen, though I usually update any packages Android Studio recommends. I've Googled and that has given me a number of things to try, but I'm no further on. I've tried the following:

I'm stuck now, and I don't know what else to try. Would anyone suggest anything else I could try?

Also, I reckon I could temporarily push the app to the device using the command line, but I'm not sure what to push if I'm only testing, as I don't have an apk file (I think). Which file would I push over to the emulator? And how do I do that? The emulator appears to be called emulator-5554.

I am on Windows 10, and have upgraded to the latest Android Studio (2.1.3).

Upvotes: 4

Views: 9402

Answers (2)

varun
varun

Reputation: 2117

Preface: Although my answer focuses on Android Studio's perspective of ADB errors, I'm sure it is helpful for Windows ADB debugging in general!

Wow, I understand the frustration from debugging for hours on long, here is my take on this strange error!

I used to get "Unable to detect adb version, adb output:" on Android Studio while trying to "run" the app onto the phone... and no devices showed up when phone was connected to PC.

I had tried all these (from different SO answers) but none of them worked!!!:

  • "Invalidate cache and restart" from File toolbar.
  • Turn off and turn on USB debugging on phone multiple times
  • Experimented with "MTP", "PTP", "Midi" and "Charging" modes to see if ADB detects something...
  • Checked my anti-virus software to see if adding exceptions to the adb directory works...
  • Installed various unnecessary C++ re-distributables
  • Tried a different USB cable (and USB port)
  • Restarted Android Studio and PC
  • and even uninstalled and re-installed Android studio!

The problem finally was that the platform_tools\adb.exe file downloaded by the official SDK tool manager was corrupted! So I used to get windows error code 0xc0000142 on launching adb.exe from command prompt! :(

SOLUTION:

For future readers (and victims xD) of the above ADB problem, please do the following:

  1. Firstly, add the platform_tools\ directory into the system path environment variable.

  2. Go ahead and replace the following 3 files in your platform_tools (C:\Users\{YourAccount}\AppData\Local\Android\Sdk\platform-tools) directory. (Please backup the same folder before, just in case.)

ADB kit (internal version number: 32)

Upvotes: 8

sreya sreedharan
sreya sreedharan

Reputation: 1

Check in the task manager whether any other process ( mine was something daemon)might be using your port number. End that process.

Upvotes: 0

Related Questions