When building apps for Android using obscure devices such as the one I was using, sometimes the ADB (Android Debug Bridge) cannot find the device. I spent a long time trying to find out why my device was not appearing in adb, as Windows picked it up in the Device Manager and in Windows Explorer.
Usually, just installing the “Google USB Driver” by using the Android SDK Manager, results in all you problems going away. But, with the more obscure devices, this sometimes does not fix the issue.
The first step is to ensure that the device is installed. This can be checked by using the Windows Device Manager. If the device is not installed, it will be under “Other Devices”, then you just need to install it manually. If you downloaded the drivers by using the Android SDK Manager, then you can find them in a subfolder of the SDK ([sdk]\extras\google\usb_driver\). There should be a file called android_winusb.inf. There is also another way to obtain these drivers without using the Android SDK Manager, and that is directly off their website (latest_usb_driver_windows.zip). You can then extract the files to a convenient location so that you can install the drivers using the Device Manager.
- To install the drivers, you can right click the “Unknown Device” under “Other Devices” (It may be a partial/vague bit of a device name – for example, mine is just “Full”), and click “Update Device Software…”. This will start the wizard.
- On the first page, you can click “Browse my computer for driver software” (we want to select our downloaded files manually).
- We then click the “Let me pick from a list of device drivers on my computer” button as we want to do the install manually as Windows will not detect the driver as they are generic.
- The first item in the list of hardware types will be “Show All Devices”, select that and press “Next”.
- On the next page, there will be a “Have Disk…” button. Press that and then we can browse to where we have either extracted or installed the drivers to (the file we must select is android_winusb.inf). Press “OK” and then you should be back to the page that contains the “Have Disk…” button.
- Above the button will be a list with 3 items, select the “Android ADB Interface” and press “Next”.
- Windows will show a warning dialog that says that the device driver is not recommended. We can safely press “Yes” as this is just because this is a generic driver.
- Windows will install the driver and when it is finished, we can close the window.
Our device (“Android ADB Interface”) should now be under the “Android Device” item. The device is just installed, and this may be all we need. You can run the ADB DEVICES command to see if the device is detected.
If the device is not detected, then we may have to manually specify the device as a valid Android device for ADB. In order to do this we need to find out our device Hardware ID.
- We can obtain the Hardware ID via the Device Manager. We can just right-click out newly installed “Android ADB Interface” item and press “Properties”.
- On the “Details” tab, select “Hardware IDs” from the dropdown. There may be one or more items here, but you can use the one that starts with “USB\VID_####” (the #### is the 4 character device Hardware ID). I have an item labeled “USB\VID_2207&PID_0010&REV_0222&MI_01”, thus my Hardware ID is “2207”.
- Now, the short way to add the device to ADB is to just add the device Hardware ID to the adb_usb.ini file (%USERPROFILE%.android\adb_usb.ini).
- If this file does not exist, you can safely create it.
- Open the file in Notepad and add a new line to the end of the file in the form “0x####” (again the #### is the Hardware ID). In the case of my device, I added a line “0x2207” to the bottom of the file.
You should be able to now restart ADB and the device should be listed. You can do a restart by running 2 commands ADB KILL-SERVER and then ADB START-SERVER.
As the Android SDK Manager may overwrite the files here, you changes may be lost later. The correct way to ensure the install the device for ADB is to create a new add-on. This is simply creating a new file in a new folder under the “add-ons” folder in the SDK ([sdk]\add-ons\).
- The first thing to do is create a new folder for you add-on. You can pick any folder name as long as it won’t conflict with any other add-ons. I picked “small-tablet” as I don’t think that is a add-on name that is used elsewhere.
- Inside that new folder, create a manifest.ini file.
- name – the add-on name
- api – the API level on the device – mine was 4.0, thus 14
- usb-vendor – the hex Hardware ID – mine was 2207, thus it will be 0x2207
- The item should now appear in the Android SDK Manager under “Extras”.
The contents of the manifest.ini file should be something like this, with the most important items:
description=That cheap 7″ tablet
And there we go, we now have a nameless device in our Android SDK Manager.