Lately I found my self wanting to debug an Android app I’m trying to take care of. When attempting to just activate USB debugging on some test devices and connecting them to my laptop I was reminded that on Windows 7 sadly things are not all that easy.
But there is actually a way around searching the internet for vendor specific device drivers and using just Google’s USB drivers instead. So if you regularly find yourself in the situation of adding new Android test devices to your pool and deploying your apps through ADB from Windows, this might help you speed up your initial setup process.
TL;DR: Yes, that’s my problem, what do I do? Click!
If you have ever developed an Android app and got to the point where you want to see your app running on a physical device, you know how tedious it can be to connect your Android phone with the Android debug bridge on Windows 7. Enabling USB debugging in the device’s developer options simply isn’t enough. As Google describes in the documentation:
If you are developing on Windows and want to connect a device for testing, then you need to install the appropriate USB driver. This page provides links to the web sites for several original equipment manufacturers (OEMs), where you can download the appropriate USB driver for your device.
Sounds simple enough, right? Well, in my experience this step can be quite cumbersome.
The mentioned list of links is of mixed quality and sometimes offers nothing more than a link to a generic support downloads web site, like in Samsung’s case. Despite the improvements – I remember that a few years ago the only thing Samsung would offer to get ADB running with their devices was to install their entire software suite for phones called Samsung Kies – it still feels very inefficient to browse through the OEM’s web sites like the one from Samsung, trying to figure out which download might help you set up the ADB connection without installing unnecessary bloatware on your system. This is especially annoying when you compare this to the comfortable solution that exists for Google’s own Nexus devices.
For Google’s Nexus devices all you need to do is install the Google USB driver, which is very pain-free, since it can be done through the Android SDK Manager. Luckily you can actually use the Google USB driver for non Nexus devices as well!
- Install the Google USB driver as described in the docs
- Activate USB debugging in the device’s developer options as described here
- Connect your device with your development machine by USB
- Wait for Windows to tell you it wasn’t able to set up a device
- Open the Windows device manager
- Search in the “Other devices” section for your Android device (anything like “Android”, “Android USB”, “Samsung Android” etc.)
- Right click that device and select “Properties” -> “Details” -> “Hardware Ids”
- Copy the Ids containing VID, PID and MI (when in doubt, take the longer one)
- Open android-sdk\extras\google\usb_driver\android_winusb.inf
- Add a line at the end of both the [Google.NTx86] section and the [Google.NTamd64] section like this:
%CompositeAdbInterface% = USB_Install, *copied Id*
- Choose “Properties” -> “Driver” -> “Update Driver…” and point it to android-sdk\extras\google\usb_driver\
- Once driver update is completed verify with
adb devices -lthat your device is there
Reap the rewards
This method allows me to set up several test devices quickly. This is a good thing, because I can invest that saved time in actually debugging the app at hand!
I will follow up with a short post to share how to use adb and a little command-line kung fu to install an app to debug on multiple devices at once, saving you even more time for what you are actually trying to do: Fix that pesky little bug!