If you do any Android development in Ubuntu it is much better to test your applications on a real device rather than just relying on the emulator.

If you just connect the phone to the computer through USB and run adb devices you will find out that your phone is not recognized:

$ adb devices
List of devices attached
???????????? no permissions

This is easily fixable in Ubuntu. You have to add a line to a file in the /etc/udev/rules.d directory.

What line in which file depends on the manufacturer and model of the device. You can find out the Vendor ID number and Product ID number of the device by running (after you connected it via USB of course):

$ lsusb

For example, if you had a Nexus One connected you would get:

Bus 002 Device 004: ID 18d1:4e12

In this case the Vendor Id is “18d1” and the Product ID is “4e12”. Please keep in mind that the Vendor ID for HTC changed from “0bb4” to “18d1”. The older HTC phones like the G1 have a Vendor ID of “0bb4”.

Here is how to set up some of the major Android phones:

Step 1. Enable Unknown sources and USB debugging:

Go to Settings -> Applications and check the Unknown sources check-box, then go to Development and enable the USB debugging.

Step 2. Depending on your phone follow these instructions:

  • G1
    Create/edit a file in /etc/udev/rules.d called 51-android.rules:

    $ sudo gedit /etc/udev/rules.d/51-android.rules

    Add the following line to it and save it:

    SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0bb4″, ATTRS{idProduct}==”0c01″, MODE=”0666″

  • HTC Hero

    Add to the file (or create it if it does not exist- see above) /etc/udev/rules.d/51-android.rules the following line:

    SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0bb4″, ATTRS{idProduct}==”0c02″, MODE=”0666″

  • HTC EVO

    Add to the file (or create it if it does not exist- see above) /etc/udev/rules.d/51-android.rules the following line:

    SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0bb4″, ATTRS{idProduct}==”0c8d”, MODE=”0666″

  • HTC EVO Shift

    Add to the file (or create it if it does not exist- see above) /etc/udev/rules.d/51-android.rules the following line:

    SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0bb4″, ATTRS{idProduct}==”0ca5″, MODE=”0666″

  • HTC ThunderBolt

    Add to the file (or create it if it does not exist- see above) /etc/udev/rules.d/51-android.rules the following line:

    SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0bb4″, ATTRS{idProduct}==”0ca4″, MODE=”0666″

  • LG OPTIMUS LG-P506

    Add to the file (or create it if it does not exist- see above) /etc/udev/rules.d/51-android.rules the following line:

    SUBSYSTEMS==”usb”, ATTRS{idVendor}==”1004″, ATTRS{idProduct}==”618e”, MODE=”0666″

  • Motorola Xoom

    Add to the file (or create it if it does not exist- see above) /etc/udev/rules.d/51-android.rules the following line:

    SUBSYSTEMS==”usb”, ATTRS{idVendor}==”22b8″, ATTRS{idProduct}==”70a9″, MODE=”0666″

  • Motorola Droid
    Create/edit a file in /etc/udev/rules.d called 10-motorola-droid.rules:

    $ sudo gedit /etc/udev/rules.d/10-motorola-droid.rules

    Add the following line to it and save it:

    SUBSYSTEMS==”usb”, ATTRS{idVendor}==”22b8″, ATTRS{idProduct} ==”41db”, MODE=”0600″

  • Nexus One
    Create/edit a file in /etc/udev/rules.d called 99-android.rules:

    $ sudo gedit /etc/udev/rules.d/99-android.rules

    Add the following line to it and save it:

    SUBSYSTEM==”usb”, ATTRS{idVendor}==”18d1″, SYMLINK+=”android_adb”, MODE=”0666″

Step 3. Restart udev:

$ sudo restart udev

Check if the device is recognized:

$ adb devices

You may need to stop and start the adb server:

$ adb kill-server
$ adb start-server

Update: Please note that some devices require to disconnect the usb cable at this point and then reconnecting it.

You should be good to go…

How to connect your Android phone to Ubuntu to do development, testing, installations or tethering

69 thoughts on “How to connect your Android phone to Ubuntu to do development, testing, installations or tethering

  • February 25, 2012 at 1:47 pm
    Permalink

    tried a lot with LG optimus one(P500)
    lsusb shows
    Bus 001 Device 013: ID 1004:618e LG Electronics, Inc.

    so had put the below onto /etc/udev/rules.d/51-android.rules.
    SUBSYSTEMS==”usb”,ATTRS{idVendor}==”1004?,ATTRS{idProduct}==”618e”, MODE=”0666?

    adb devices
    List of devices attached
    emulator-5554 device
    ???????????? no permissions

    well i even tried disconnecting and reconnecting it.

  • February 25, 2012 at 2:57 pm
    Permalink

    @ rohith,

    You have ? instead of double quotes.

  • March 4, 2012 at 10:14 am
    Permalink

    Hi Dimitar,

    I am using Samsung Galaxy3 – i5801 device and Ubuntu 10.10 on my Dell laptop. I tried your procedure to connect the device and to debug Android application directly on my device but no success.

    Please do help me.

    Thanks in Advance,
    Shashikiran

  • Pingback:[Teclast] USB Vendor ID - Forum Android Italiano

  • June 5, 2012 at 12:55 am
    Permalink

    tried with htc verizon 4g

    adb devices
    List of devices attached
    emulator-5554 device
    ???????????? no permissions

    I am using htc verizon 4g device and Ubuntu 11.10 on my Dell desktop. I tried your procedure to connect the device and to debug Android application directly on my device but no success.

  • June 8, 2012 at 12:05 pm
    Permalink

    Excellent guide. A big thanks to you. Only one suggestion: The following line is pretty important as I thought there was some other error and read this line later. Is it possible to increase its font/bold it so that it grabs the reader’s attention sooner:

    Update: Please note that some devices require to disconnect the usb cable at this point and then reconnecting it.

    Thanks!

  • December 6, 2012 at 4:07 pm
    Permalink

    Hi,
    thanks for this post,
    GROUP=”plugdev” was the solution here
    for my samsung galaxy s2
    had the “???????????? no permissions”
    with “adb devices”.
    I had to add this rule to udev in order for the phone to be detected:
    SUBSYSTEMS==”usb”, SYSFS{idVendor}==”04e8″, SYSFS{idProduct}==”685e”, MODE=”0666″, OWNER=”MyUser” , GROUP=”plugdev”

    and after restarting udev, killing and starting adb server, unplugging and plugging back the s2 it was detected \o/

    cheers

  • January 27, 2013 at 12:46 am
    Permalink

    This process worked for me, thanks. For the HTC Incredible I used

    SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0bb4″, ATTRS{idProduct}==”0cac”, MODE=”0666″

    It didn’t seem to work initially, but that was because when I tried cutting and pasting the line in the original post the quotation mark characters were not the regular ones (eg they were italicised one way or another).

  • February 13, 2013 at 4:41 am
    Permalink

    Awesome. worked on Aakash Tablet.

    Thanks 🙂

  • May 16, 2013 at 8:42 am
    Permalink

    Worked for me after fiddling around for a while as well.
    I didn’t noticed the wrongly copied quotation mark characters.
    So:

    !!
    Be sure your text in the file contains only correct Ascii quotes (“) instead of those that come with the text when you use copy&paste. Try to rewrite them in the editor.
    !!

  • July 1, 2013 at 5:10 pm
    Permalink

    My Motorola Droid 3 worked with

    SUBSYSTEMS==”usb”, ATTRS{idVendor}==”22b8?, ATTRS{idProduct} ==”41db”, MODE=”0600?

    but on the /etc/udev/rules.d/51-android.rules file

  • August 11, 2013 at 12:51 pm
    Permalink

    i have HTC sensation it is detected in dmesg command having vendor id 18d1 and product id 4e22 but it is not detected by adb
    i have tried editing file android 90 as well as all combos including 666, 600 and symlink but its still not working
    any help plz

  • September 27, 2013 at 11:20 pm
    Permalink

    Hi,
    I have a Navcity NT 1710 and my lsusb display this:

    Bus 001 Device 007: ID 18d1:0003 Google Inc.

    I added the content in the file 51-android.rules:
    SUBSYSTEM == “usb”, ATTR {idVendor} == “18d1”, ATTRS {idProduct} == “0003”, MODE = “0666”, GROUP = “plugdev”

    and still is not recognized, can help me?

  • Pingback:Android setting your device to develpment | Pedro Rainho

  • August 24, 2014 at 1:32 pm
    Permalink

    I am using General Mobile Discovery 16 GB , I have not any information about it’s //Step 2. Depending on your phone follow these instructions:// Step. Is there anyboyd who knows its special code for step two ?

  • September 24, 2014 at 4:44 pm
    Permalink

    I am using General Mobile Discovery 16 GB

    SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0bb4″, ATTRS{idProduct} ==”0c03″, MODE=”0666″

    works for me after corrected “ mark with ” mark

  • February 24, 2015 at 1:33 am
    Permalink

    hi..
    what to do for Motorola-G2.
    I am unable to connect even after following the above process.
    I tried:
    SUBSYSTEMS==”usb”, ATTRS{idVendor}==”22b8?, ATTRS{idProduct}==”2e76?, MODE=”0666?
    SUBSYSTEMS==”usb”, SYSFS{product}==”Android Phone”, MODE=”0666″

  • May 10, 2017 at 11:20 am
    Permalink

    # Motorola PCS (XT1033)
    SUBSYSTEM==”usb”, ATTRS{idVendor}==”22b8″, ATTRS{idProduct}==”2e82″, MODE=”0666″, GROUP=”plugdev”

Leave a Reply

Your email address will not be published. Required fields are marked *

*