– 🕓 3 min read

Android Development Device Setup in Ubuntu 10.04

I spent part of last night setting up my HTC Desire as a development device on my Ubuntu laptop.  This was a somewhat frustrating process, because a lot of the information I came across seem to be outdated and didn't work for me.  Even the official documentation refers to a version of Ubuntu which is more than two years old.  I did eventually piece together the correct process for Ubuntu 10.04, so I'm documenting that process here in the hope that it will help out other developers in the future.  This guide assumes that you've already installed and configured the Android SDK.

  1. Connect your phone to your computer and open a terminal window.  Run adb devices to confirm that adb can "see" your phone. You should see something like this:
    \( adb devices
    List of devices attached
    ???????????? no permissions</code></pre>
        </li><li>Type <code>lsusb</code> to get a list of attached USB devices.  Look for an entry with your phone's manufacturer; for instance, since I have an HTC device, I get:
    <pre><code>\) lsusb
    Bus 002 Device 003: ID 0bb4:0c87 High Tech Computer Corp. 

    Note the ID - in my case, 0bb4:0c87. The part before the colon is the vendor ID. The part after it is the product ID. Keep these in mind.

  2. You'll now need to create a udev rules file using your preferred text editor. This guide lists a number of different file names per-device, but based on my reading of the udev man page, I don't believe the file name is actually important. The official documentation recommends 51-android.rules, which is what I went with. You'll need to use sudo to get permission to create the file:
    \( sudo vi /etc/udev/rules.d/51-android.rules</code></pre>
    The contents of the file should be as follows:
    <pre><code>SUBSYSTEMS=="usb", ATTRS{idVendor}=="[Vendor ID]", ATTRS{idProduct}=="[Product ID]", MODE="0666"</code></pre>
    ...where the bracketed bits are replaced with the IDs you got earlier from lsusb.  For my HTC Desire, I entered:
    <pre><code>SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0c87", MODE="0666"</code></pre>
    Save the file.  Most of the documentation I've come across says that restarting adb and udev is sufficient to give adb access to your device, but <strong>in my case I had to completely restart my computer before adb properly recognized my phone.</strong>  Nevertheless, it's probably best to adb and udev first:
    <pre><code>\) sudo restart udev
    $ adb kill-server
    $ adb start-server
    Run adb devices again to see if your phone is recognized. If you still see ???????????? no permissions, you'll probably need to restart your computer.
  3. You should now have full access to your phone from adb and Eclipse.

I hope this proves helpful. If you have any corrections or if this method didn't work for you, leave a comment.