adb got same serial number when two phone are connected on a pc. Can I change the serial number?

smanulla picture smanulla · Jan 21, 2013 · Viewed 7.9k times · Source

I have two devices connected at the same time to a computer. If I use command: adb devices, adb got this:

List of devices attached 0123456789ABCDEF device 0123456789ABCDEF device

So, the devices have the same serial number! I want to manage both devices via USB for debugging my application, but I have this error:

[2013-01-21 20:28:12 - DeviceMonitor] Failed to start monitoring 0123456789ABCDEF : more than one device

I think I have this error because the devices have the same serial number. I read other discussions and I try these instructions on terminal:

$ su

getprop net.hostname

android-b112064be9bfd82

So..0123456789ZBCDEF isn't the serial number.

Someone know how can I change the serial number? Sorry for my bad english.

Answer

scottt picture scottt · Feb 27, 2014

To temporarily (until reboot) change the ADB serial number, disconnect all but one of the devices and type this in a command window:

adb shell 'echo -n "XXXXXXXXXXXXXXXX" > /sys/class/android_usb/android0/iSerial'

where the X's represent the desired serial number. This change requires root and will only last until the device is rebooted. To make it permanent, you'd need to alter one of the system startup scripts to make the change.

Note that this doesn't seem to work as often on newer devices; the file location has apparently changed.