Sunday, June 28, 2009

Developing on an Android device using Ubuntu 9.04

Google's documentation is sometimes out of date, and on this topic it was clearly erroneous, so for anyone interested, here is how I managed to bridge an HTC Magic and Ubuntu 9.04 Jaunty to allow debugging over USB:

On the phone, in Settings/Applications/Development, check the box "USB debugging".

On the computer, install the Android SDK, change to the "tools" directory, then log as root and create file /etc/udev/rules.d/50-android.rules with this content:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
and file /etc/udev/rules.d/90-android.rules with this content:
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"

Then type this:
sudo chmod a+rx /etc/udev/rules.d/50-android.rules
sudo chmod a+rx /etc/udev/rules.d/90-android.rules
sudo /etc/init.d/udev restart
./adb kill-server

You should get something like this:
./adb devices
List of devices attached
HT963LF01297 device


  1. I follow your instruction... unfortunetaly list of devices is empty with a Galaxy USB connected and USB Debug...

  2. That's because the Galaxy is produced by Samsung, not HTC.
    So I guess the vendor id is 04e8 instead of 0bb4.

    More information at the top of this page:

    Nicolas Raoul.

  3. Well..this may be old.. but I just got my Droid and am trying what you put there. Problem is, adb devices lists as:

    ??????????? no permissions

    not sure why this is? I put the droid into USB debug mode, selected to mount it, folder opens up on my Ubuntu 9.04 showing the contents. It is clearly "seeing" it, but it's not able to determine it I guess?

  4. Incidentally, I DID select the motorolla id info, still not working.

  5. Well I found another post but can't seem to paste into this edit window.. and it's a very long URL. Needless to say, the udev rules you typed in was missing a letter (or at least it seems to be)

    You have SUBSYSTEM and it should be SUBSYSTEMS, as well it should be ATTRS not ATTR. But I could be wrong..I added that in and it seems to work now.

    Anyway, the one link shows the following for the moto droid:

    SUBSYSTEMS=="usb", ATTRS{idVendor}=="22b8", ATTRS{idProduct}=="41db", MODE="0666", OWNER="your username here"

    For some reason ATTRS instead of SYSFS?? Not sure the diff on this rules file. As well, the OWNER at the end, and keep in mind the ATTRS has TWO = signs after each (as does the SUBSYSTEMS), the MODE and OWNER only have a single =.

    Make sure your Moto Droid is NOT plugged in (if it is, unplug it, then plug it in again) AFTER you run the adb kill-server command. Then, adb devices seems to list some long number instead of a name. At least now when I run my app from Eclipse, it runs on my Moto Droid.

  6. Well, it is working with SUBSYSTEM and ATTR, it is not a typo.

    My instructions also work on Ubuntu 2009.10 Karmic Kaolo, I just tried.