Ubuntu is not detecting my android device

I am new to android. I have just downloaded and installed android sdk. Now when I run the application from eclipse, my device is not getting detected. I have googled and was brought up with this as my solution, but that also didn't worked.

Here's the 51-android.rules

SUBSYSTEMS=="usb", ATTR{idProduct}=="0bb4",  ATTR{idProduct}=="0c03", MODE="0666", GROUP="plugindev", OWNER="<username>"

After that I rebooted my laptop, and ran this command:

username@laptopname:~/Android/adt-bundle/sdk/platform-tools$ adb devices

The output i get is:

* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached 
????????????    no permissions

EDIT

crazydeveloper@crazydeveloper:~$ lsusb
Bus 002 Device 004: ID 0bb4:0c03 HTC (High Tech Computer Corp.) 
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 04f2:b337 Chicony Electronics Co., Ltd 
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
crazydeveloper@crazydeveloper:~$ ls -l /dev/bus/usb/004/
ls: cannot access /dev/bus/usb/004/: No such file or directory
crazydeveloper@crazydeveloper:~$ 

Edit: 2

After the answer submitted here's the output that i got:

crazydeveloper@crazydeveloper:~$ ls -l /dev/bus/usb/002
total 0
crw-rw-r--  1 root root    189, 128 May  7 09:45 001
crw-rw-r--+ 1 root root    189, 129 May  7 09:45 002
crw-rw-rw-  1 root plugdev 189, 130 May  7 09:48 003

I am using Micromax Canvas 2.2 A114 - Android Version 4.2.2

Please help me. Thanks.


OK here are all the steps to get this to work. I had problems with all responses I found online, bits and pieces everywhere without any certain order and no single working solution, (running Android Studio, Jmonkey 3D, and Ubuntu 14.04)

If adb devices shows android device as ????????? (no permissions) follow these instructions:

  1. create file /etc/udev/rules.d/51-android.rules

    sudo gedit /etc/udev/rules.d/51-android.rules
    
  2. copy and paste contents below:

    SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0e79", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="413c", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="091e", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="24e3", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="2116", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0482", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="17ef", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0666", GROUP="plugdev"    
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0409", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="2080", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0955", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="2257", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="10a9", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="1d4d", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0471", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="04da", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="1f53", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="04dd", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0930", MODE="0666", GROUP="plugdev"  
    SUBSYSTEM=="usb", ATTRS{idVendor}=="19d2", MODE="0666", GROUP="plugdev" 
    
  3. Run the following command to change file permissions:

    sudo chmod a+r /etc/udev/rules.d/51-android.rules
    
  4. connect your phone via usb and run the following command:

    lsusb
    

    Look for your device(s) Example (Nexus 5):

    Bus 003 Device 074: ID 18d1:4ee7 Google Inc.

    For Nexus 5, Vendor ID is 18d1, mine is on Bus "003" If you don't see a change when you plug in your device with lsusb, perhaps your USB cable is charge-only.

  5. Now reload the rules with the following commands:

    sudo udevadm control --reload-rules
    sudo service udev restart
    sudo udevadm trigger
    
  6. Verify device is now allowing plugdev user group access

    ls -l /dev/bus/usb/<bus number from step 4>
    

    Example:

    ls -l /dev/bus/usb/003
    crw-rw-rw- 1 root plugdev 189, 329 Jul  3 18:23 074
    
  7. Run adb devices to confirm permissions are correct and enjoy!

Note: if you haven't created the plugdev group and added your user name to it (if permission denied prepend "sudo" following commands):

  1. Add plugdev group:

    groupadd plugdev
    
  2. Add your username to plugdev group (useradd -G {group-name} username):

    useradd -G plugdev billy
    
  3. Restart udev (you may need to log off and log back in to update user group):

    sudo service udev restart
    

Try group plugdev rather than plugindev. Then restart udev:

sudo udevadm control --reload-rules
sudo service udev restart

If this doesn't work find out where exactly your device is connected with lsusb. Then check the permissions:

ls -l /dev/bus/usb/YOUR_USB_BUS_NO/

The fact that lsusb gave us:

Bus 002 Device 004: ID 0bb4:0c03 HTC (High Tech Computer Corp.)

means that your mobile is connected to Bus 002 as a device 004. Therefore udev created device object /dev/bus/usb/002/004.

Please show us the device permissions using command:

ls -l /dev/bus/usb/002/004

As a temporary workaround you could make the device world readable/writeable with this command (make sure your phone is plugged in):

sudo chmod 666 /dev/bus/usb/002/004

Then try adb devices again.

Also I noticed that at the end of the udev rule you have OWNER="<username>". You did actually replace that with OWNER="crazydeveloper", didn't you ?

Your permissions are kind of OK. udev picked up the device and set its permissions to 666 and the group to plugdev. It didn't set the owner to crazydeveloper for some reason but that isn't that important.

Make sure you are a member of group plugdev. Use this command:

sudo useradd -G plugdev crazydeveloper

Then log off, unplug the mobile, log on again, plug it in and try adb devices again. Let is know what is happening.


You have to change 2 things:

  1. Change the first 'ATTR{idProduct}' to 'ATTR{idVendor}' in the 51-android.rules file.

  2. Run these commands from the terminal:

    sudo ./adb kill-server
    sudo ./adb start-server
    sudo ./adb devices