3

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.

smanulla
  • 99
  • 3
  • 13
  • see this similar [question](http://stackoverflow.com/q/14334656/1904517) – iagreen Jan 21 '13 at 20:21
  • I have just read this discussion, but I think I don't understand what it means "populate /sys/class/android_usb/android0/iSerial sysfs file with unique values for every device" I'll search on Google what it means. Thank you for answer! – smanulla Jan 21 '13 at 20:39

1 Answers1

1

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.

scottt
  • 8,301
  • 1
  • 31
  • 41
  • I got 'permission denied' when trying this against a non-rooted device. Is this supposed to work on a non-rooted device? – Mr. Bungle Mar 15 '14 at 01:11
  • Yes, you do need root on the device. – scottt Mar 15 '14 at 02:57
  • after change serial:adb kill-server && adb start-server – falko Apr 10 '14 at 10:18
  • I use the same trick for a while now (remember using `echo -n` for that, to avoid the trailing line feed). I'd prefer to make that permanent, but there doesn't seem to be a "universal way" to achieve that unfortunately. – Izzy Jan 07 '16 at 22:33