Thursday, October 7, 2010

Getting ADB (Android Debugger) to work on Ubuntu 10.04+

In my spare time I enjoy writing Android applications and exploring the vast Android SDK. Though I have not yet published any apps to the Market, I have a few going through final QA testing which will be released soon.

Often times, I will need to get an adb shell, watch the logfiles on the phone, or want push my apps to my devices for testing or debugging on a real device. I do most of my coding in my spare time on my laptop which was running Ubuntu 10.04, and any time I tried to open adb it wouldn't connect to the device. I would just see "????????" as the serial number and "no permissions" as the device name. As a result, I have been having to use my workstation which runs Ubuntu 9.10 for all of my debugging.

I upgraded early to Ubuntu 10.10 as I often like to test the latest Ubuntu betas and release candidates. I was also hoping the latest release would fix my issue, which unfortunately, was not the case. So I started out on a quest to get to the bottom of things.

It didn't take long to discover that it's a permissions issue, and the recommended fix I found repeatedly was to kill adb server and restart it as root. I quickly tested that and surely it worked, however that doesn't work so well for starting it via Eclipse and ADT and I never want to run a program as root without good reason.

It works in 9.10, it's just a permissions issue, so I thought a quick change to the new hal rules in Ubuntu were in order, but I couldn't find any such documentation on the workings of hal and its permissions. Lots of digging around and I found a comment on XDA with a udev rule. Opened up the terminal and typed 'lsusb -v | grep 0bb4' and sure enough that was the correct vendor id for my HTC Evo.

So here are the steps I took to get it working:

echo "SUBSYSTEM==\"usb\", SYSFS{idVendor}==\"0bb4\", MODE=\"0666\"" | sudo tee /etc/udev/rules.d/51-android.rules
sudo restart udev

I hope that helps you. If you need to find your devices vendor id you can try this:
$ sudo lsusb -v | grep -C5 Android 2>/dev/null
  bMaxPacketSize0        64
  idVendor           0x0bb4 High Tech Computer Corp.
  idProduct          0x0c8d 
  bcdDevice            2.26
  iManufacturer           1 HTC
  iProduct                2 Android Phone
  iSerial                 3 HT05JHL0XXXX
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2

P.S. Please feel free to add your device and vendor id in the comments to save others some trouble.


  1. Setting the mode manually worked for me. Restarting udev wasn't enough and I didn't restart my machine yet to check whether the rule will work then. Anyway, kudos for figuring this one out.

    And you're right, android.rules ...

    cheers, Guus

  2. Thanks Stewart. I use Linux (Ubuntu 10.10 currently). Your post really helped me out a lot. I am now able to use my HTC Evo with the Google app inventor on Ubuntu 10.10. Brilliant.