0

I've been working on the HelloWorld app for a few weeks now, overcoming many little hurdles, and I think I've reached the last one. I'm working out of 'Learn Android Studio' by Adam Gerber (not an endorsement, just happens to be the book I'm using). I have an HTC One.

When I open the device manager, there is no device listed. In the terminal, I issue the command adb devices and I get the heading "List of attached devices" with nothing listed. If I click the green run arrow, I'm asked to choose my device, but my device isn't shown.

I used to get the error "Unable to obtain result of 'adb version'" when I opened the device manager, but I don't get that anymore, for some reason. But now, when I open Android Studio, I get a Windows Firewall window telling me that some aspects of Android Studio are blocked, including public networks. I don't know if this is the reason for my difficulty or not (I don't think connecting my phone to my laptop is like a public network, is it?).

I went to the developer.android site and followed the directions for connecting a device: How to connect an Android device to Android Studio. Step 1 is: "Verify that your application is "debuggable" in your manifest or build.gradle file." The details on how to do it are provided, and I made the appropriate addition to my build.gradle file. Step 2 is: "Enable USB debugging on your device." This is the thing where you tap your phone at a certain place in the settings to enable development capabilities. I did that. Step 3 is: "When plugged in over USB, you can verify that your device is connected by executing adb devices from your SDK platform-tools/ directory. If connected, you'll see the device name listed as a 'device.'" As I mentioned above, I get a heading for a list, and no items listed. My book says on page 23: "If your computer does not recognize your Android device when you connect to your computer via a USB cable, you probably require a USB driver. If your computer initially recognizes your Android device, you should probably forgo installing a different or newer version of the USB driver, as this could cause the USB connection to fail." Since I've transferred image and music files to and from my HTC One dozens of times, I followed this advice and did not install a driver (Actually, before I read this book, I had started looking for a driver, following the links on the developer.android site, but I wasn't able to locate one).

On another site where programmers congregate, someone gave me this list of 4 items to check: - Have you reinstalled adb? (I'm not sure what this means.) - Do you have the DeveloperOptions SubMenu enabled on your phone? (yes) - Do you have USB debugging enabled on your phone? (yes) - Do you have AllowMock Locations enabled on your phone? (I did not, and I enabled it.)

Regarding the first item, my adb is an exe. How do I 'reinstall' that? I responded to his message, and he has not responded to clarify what he means.

Regarding mock locations, that was not enabled, and I enabled it and tried again to connect my phone to Android Studio. That's when the Windows Firewall window showed up for the first time. I don't know if it's because I enabled mock locations or not.

I also tried rebooting after starting the adb, as suggested by my book, on page 25, but that didn't do anything. "If after restarting the ADB server you still don't see the device, it's possible, though unlikely, that the USB driver requires a system reboot to take effect." I've noticed that adb starts up when I boot up (I tend to keep the task manager open), so I know my problem is not that the adb is not running.

I looked at many similar questions on this forum, and the most common advice seems to be to install a driver. Since my book says a driver might not be necessary and could ruin my USB connecting ability, and also since some programmers stated that their Android Studio connection to their phone was failing in spite of installing drivers, I'm not rushing to install a driver, especially since I need USB connectivity on my phone for my job.

So this is where I am. So, what about this statement in my book that if my laptop can see my phone, I don't need a driver. Would that be true? What else could be the problem?

Any help/suggestions/comments gratefully appreciated.

jana
  • 81
  • 3
  • 10
  • As far as i know it's true that if you have the right drivers you can see you phone in android studio. Maybey my answer on this question helps you out, if you have a rooted device its extremely easy (else a litle bit more work) to connect over wifi ! http://stackoverflow.com/questions/31817019/adb-over-wifi-killed-off-after-usb-disconnect/32059533#32059533 – Sven van den Boogaart Aug 18 '15 at 14:34
  • I'll keep this in mind, I'd like to try it sometime. Right now, I don't know enough, so it would be risky for me, I think. – jana Aug 18 '15 at 15:43

1 Answers1

0

The fact that your computer can see your phone does not mean that you don't need a driver.

What that means is that your computer has the appropriate drivers installed for recognizing your phone as a media device.

What you need is for your phone to be recognized as an ADB device. These are often different drivers from the phone drivers that are installed by default, as the vast majority of users do not need to use developer tools with their phone.

If you can find these drivers from HTC, then they are very safe to install and the risk to your computer is negligible. Google's USB drivers installed via the SDK manager work for many devices and are also safe, though I cannot speak as to whether they will work with the HTC One or not.

Bryan Herbst
  • 66,602
  • 10
  • 133
  • 120
  • I'm going to look for a driver and give this a try. – jana Aug 18 '15 at 15:46
  • SOLUTION: I updated the HTC Sync Manager and it automatically installed the adb driver I needed. The Sync Manager launches every time I connect my phone to my laptop. Problem Solved! – jana Aug 24 '15 at 11:23