Connecting to Any Android with ADB via USB

I’ve seen other attempts at universal ADB (Android Debug Bridge) drivers, but I’ve tested those and not had any luck. The following steps have worked for a wide variety of devices that I’ve tested it with. With such a huge variety of different Android devices available it isn’t always easy to find the right USB driver, but you need an ADB USB driver to connect development and debugging tools. This is different then being able to add and remove files from the Android device.

Disclaimer: I’ve done this a few times, and talked to others who have done it too, all without any incident. This is however a bit of a hack, and may result in some unintended consequence, which may including voiding your warranty, damaging your computer, damaging your android device, or even causing your hair to fall out. Proceed at your own risk.

First of all, you need the Android SDK installed. You don’t need the ADT Bundle or Android Studio if you don’t want those. Just scroll down to Use an Existing IDE. If you have RAD Studio XE5 (an edition with Mobile) installed then you had the option to install this during the RAD Studio install. I’ll include directions for either installation method. Google provides a USB driver for their Nexus line of devices. This is the driver we are going to use, but first we need to modify it to work with our device. I’m assuming you are running Windows. OS X doesn’t need device specific USB drivers.

These directions are for Windows 8.1. Run the Android SDK Manager. You can do this from the Android Tools start menu item that is installed with RAD Studio, or run the android.bat file located in the SDK\Tools folder of the Android SDK installation. This brings up the Android SDK Manager. Scroll to the bottom and look for Google USB Driver in the Extras category. If that is not installed then put a check mark next to it and install it. Android SDK Manager - Extras - USB Driver Next go to the folder where your Android SDK is installed. With RAD Studio XE5 the default install location is  under Users\Public\Documents:

C:\Users\Public\Documents\RAD Studio\12.0\PlatformSDKs\adt-bundle-windows-x86-20130522

From there go to the \sdk\extras\google\usb_driver folder, as that is where the Google USB Driver is installed. I typically make a copy of these folder somewhere else, as we will be modifying some of these files. If you get an updated driver, then your changes will be overwritten if you leave them here. Next we need to go to Device Manager with your new Android device attached (and in developer mode). Look for the entry for Android under Other devices. Device Manager - Other Deivces - Android This is your Android device without a driver loaded. If you don’t see it then either it isn’t connected, or your Android device isn’t in developer mode. It is possible it may show up with the name of the Android device, but it should still be under “Other devices” and have the yellow triangle on it. Right click on this device and select properties. Android Properties - No DriverThen go to the Details tab and from the dropdown select the Hardware Ids property.AndroidProperties-Details

These are the identification for your specific Android device. It should look similar to the picture above.

USB Driver file in folder

Now using your favorite text editor open the android_winusb.inf file we found in the usb_driver folder above. Locate the line that says [Google.NTamd64]. You’ll see some entries above this line, these are for 32-bit installs (it is section [Google.NTx86]), and the entries after the line are for 64-bit installs. Chances are you only need to edit one section, since you are doing this for your own windows install, but you can edit both sections if you are not sure. The lines are the same.

So add lines similar to the following in the section(s) you choose.

;Samsung Galaxy S3 
%SingleAdbInterface% = USB_Install, USB\VID_04E8&PID_6860 
%CompositeAdbInterface% = USB_Install, USB\VID_04E8&PID_6860&MI_03

You probably noticed that is that crazy looking string on the right looks really similar to the values we saw for the Hardware Ids from device manager. The line prefixed by the semicolon is a comment, so I usually put the name of the device there.

Notice that the portion of the identifier with REV_#### is missing (I usually leave it off, but it should work either way). Also the %SingleAdbInterface% line doesn’t have the MI_## portion, while the %CompositeAdbInterface% line does include it. You might need to experiment with this to find what works (again remember the disclaimer).

If you want to load the driver for Google Glass, then it should look something like the following.

;Google Glass
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_9001&REV_0216&MI_01
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_9001&MI_01

%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_9001&REV_0216&MI_00
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_9001&MI_00

(the first two lines are for the 2nd edition, the second two lines are for the 1st edition I believe).

Advanced: If you want to load the driver for the bootloader, then put your device into bootloader mode and add a %SingleBootLoaderInterface% line for the value that shows up in Device manager then (it will be different).

Now save the android_winsub.inf file. Unfortunately since it is modified, the signature is invalid and Windows won’t let you load it. With Windows XP this wasn’t such a big deal, but in recent versions the driver signature is enforced. There is a way around it though.

Check out the following guides for loading unsigned drivers in specific OS:

I’ve also made a video of the process on Windows 8.1

What to learn more about connecting to devices and gadgets? Join me for my free webinar on Programming Devices and Gadgets with RAD Studio on January 22nd.

Programming Devices and Gadgets with RAD Studio

This entry was posted in Android, Tools. Bookmark the permalink.

28 Responses to Connecting to Any Android with ADB via USB

  1. gabr42 says:

    Incredibly useful, thanks!

  2. Jim McKeeth says:

    I’ve tried a few of them, with no luck. Not sure if I tried that one or not though. Curious how it works since drivers are installed based on Vendor ID and Product ID since each one I’ve looked at has a different values.

  3. IL says:

    Perhaps, the same way you just showed. The package now supports
    Google Nexus Devices ADB & Fastboot
    Samsung Devices ADB & Fastboot
    Asus Devices ADB, Fastboot & APX
    HTC Devices ADB & Fastboot
    Nvidia Shield ADB (ADB & Fastboot Only, will update with Nvidia Shield APX)
    http://forum.xda-developers.com/showthread.php?t=2513339

  4. Jim McKeeth says:

    I looked at that package and they have just edited the INI the same way I did for a lot of different common devices. So if your devices isn’t in the supported list (no matter how long) then you still need to edit it to add your device.

  5. Anton Aderum says:

    Hello! Would you have any idea as to why I could deploy and start an application into my android device but not debug it (IE step through code)? The device shows up as a device in the “Target” explorer in XE5, and the Android ADB Interface Driver is also installed. The device is an Panasonic Toughpad. It works if I use my Samsung Galaxy S3, but not with the tablet.

    I can debug it if i create an application through Eclipse and deploy it, but not with XE5. I can also see the device through the command window if i run “adb devices”. It is only the attachment to the process that does not work if I use XE5 with this device.

    Thanks.

  6. Jim McKeeth says:

    What happens when you try to debug? What version of Android does the tablet run?

  7. Anton Aderum says:

    When I try to debug from XE5 it will deplot the app to the tablet, but after the app starts XE5 will not be attached to the process. So I cant make it stop at break points or use any of the debug features. How ever if i create an app in Eclipse and use the same tablet i cant attach to it and debug properly.
    The tablet runs android version 4.0.3

  8. Pingback: Oh Yeah, the Ouya! | The Podcast at Delphi.org

  9. Ivan says:

    For Windows 8.1, you can do this: http://stackoverflow.com/questions/21972658/adb-driver-and-windows-8-1

    It’s a solution for the same problem, but simpler.

  10. Jim McKeeth says:

    Ivan: That appears to just work for Samsung devices since it is loading the Samsung driver. My process is more complicated, but will work for any device, even those that do not have a released driver.

  11. Jim McKeeth says:

    Anton: Are you building a debug configuration and launching in debug mode?

  12. Carolina says:

    Hello, can you help me? I have a chinese phone, Samsung Rex imitation (S5292 I9300) I have downloaded adb driver installer but I cannot do anything> I get an error message of incompatibility (I have windoes 8.1). Can you please help me? I have the toogle debugger, it is ok, working was debugged USB, but still I get no driver intalled

  13. Jim McKeeth says:

    Check to see if the manufacturer has an update ADB driver that works with Windows 8.1. If that doesn’t work then you can follow the steps in this post to customize the default Google driver to work with your device. I’ve done this with Windows 8.1 and a few different Android devices so it should work.

  14. IvanRF says:

    Jim, sorry for the delay. What I did here adb-driver-and-windows-8-1 is not only a solution for Samsung devices. In fact, I used it for a Chinese tablet.

  15. Pingback: Install Unsigned Drivers on Windows 8.1 - Windows 8 Optimization | Windows 8 Optimization

  16. Gorbstein says:

    SUPERB. I wish there were more real solid fixes like this rather than ‘update your drivers, update windows, unplug and replug’.. etc. You are a hero.

  17. Pingback: Sony Xperia M2 | Delphi 2010 ru

  18. mrstanlez says:

    What about Linux USB Driver ?

  19. Jim McKeeth says:

    Linux and OS X do not need specific USB drivers for ADB support. Only windows does. https://developer.android.com/sdk/win-usb.html

  20. Eduardo says:

    Hello, I am trying to run the ADB on a sonim xp7 device and no matter what I try it won’t recognize the device. Anyone here knows if there is a driver or another solution? The one posted above did not work unfortunately.

  21. Jim McKeeth says:

    Eduardo: Dose the device show up in Device manager when you enable debugging? If it does then this will work. If it doesn’t then nothing will work and you need to check your USB connection.

  22. Vishal says:

    Thanks Jim. This works everytime for me. I remember doing this 2 years ago but forgot and your blog came to the recue.

  23. greentrex says:

    Eduardo: Don’t know if you will see this, but here’s what I did to get the sonim xp7 device recognized. I tried answering your question on Stackoverflow, but it was deleted.

    Contact the manufacturer to get access to the developer portal at https://developers.sonimtech.com . There are instructions to get ADB to recognize XP6/XP7 there. You will need both their drivers and vendor id numbers to add to your adb_usb.ini file which at this time is only available on their website.

  24. abhishek tarafder says:

    sir i tried to near 40 hours for this but i cant success. but i follow u and i installed successfully ,great job sir thank you.

  25. PaulS says:

    On Windows 10 there was no need to edit the inf file. I just installed the Google USB driver by double clicking the .inf file. The associated the driver with the device (ignoring the compatibility warning)

  26. Ali Rad says:

    Thanks
    its very good

Leave a Reply