[SOLVED] Eclipse can’t see my Android Device on Ubuntu

Are you seeing this on eclipse when you plug your Android device to your Ubuntu box?

Serial Number: ??????????
AVD Name: N/A
Target: unknown
State: ??

Here’s the solution:

1. Create a script to fix this next time it happens, let’s call it “android_device_reset” and save it on a folder contained on your $PATH environment variable.

[bash]
#!/bin/bash
# android_device_reset script
sudo adb kill-server
sudo service udev stop
sudo adb start-server
sudo adb devices
[/bash]

Save it and make it executable
[bash]chmod +x android_device_reset[/bash]

2. Open this file /etc/udev/rules.d/51-android.rules

Make sure it looks something like this
[bash]
SUBSYSTEMS=="usb", SYSFS{idVendor}=="0bb4", MODE=="0666"
SUBSYSTEMS=="usb", SYSFS{idVendor}=="22b8", MODE=="0666"
[/bash]

Each line represents a different android device. If you have just one, the file should be one line long.

On that example I’ve configured the rules for a Motorola Droid and a Nexus One.
If you need to know the idVendor numbers for your Android device go here
developer.android.com/guide/developing/device.html#VendorIds

3. Whenever the problem happens, just open a terminal and type
[bash]android_device_reset[/bash]

It’ll ask you for your password, only administrative users will be able to execute the script.

Hope this helps.

19 thoughts on “[SOLVED] Eclipse can’t see my Android Device on Ubuntu

  1. can you tell me where to put this script? i’m on a debian squeeze machine. i put the script in the “/etc/” folder and when i execute it, it tells me:
    adb: command not found
    Stopping the hotplug events dispatcher: udevd.

    and please tell me if i have to write:
    SUBSYSTEMS==”usb”, SYSFS{idVendor}==”0bb4″, MODE==”0666″

    or:
    SUBSYSTEMS==”usb_device”, SYSFS{idVendor}==”0bb4″, MODE==”0666″

    since i’m not on ubuntu (i know it’s based on debian).

    many thanks!

  2. @binary

    make this:

    #!/bin/bash
    # android_device_reset script
    sudo ./adb kill-server
    sudo service udev stop
    sudo ./adb start-server
    sudo ./adb devices

  3. (1)……
    /etc/udev/rules.d/51-android.rules

    the above file not found….

    the “rules.d” folder contains only these files given below:

    11-hplj10xx.rules 70-persistent-cd.rules README
    40-hplip.rules 70-persistent-net.rules

    (2)……..
    Whenever the problem happens, just open a terminal and type
    android_device_reset

    but this results that “command not found”

    I have made the same script as told and set the path already…..

    Can anybody help regarding these two problems….?

  4. Thanks, it worked for me on Archlinux 64 bit. I had only to adjust the command in android_device_reset accordingly to my system:
    sudo /home/vincenzo/android-sdk-linux_x86/platform-tools/adb kill-server
    sudo /etc/rc.d/udev stop
    sudo /home/vincenzo/android-sdk-linux_x86/platform-tools/adb start-server
    sudo /home/vincenzo/android-sdk-linux_x86/platform-tools/adb devices

    but this is also because the android-sdk folder is not in my path.

  5. It works for my galaxy S
    I’ve try many ways to make it works and after a lot of changes and resets, I never achived to make it works.

    But YOUR script for reset adb connection is magic, and it works like a charm 🙂

  6. ###### Linux Mint 17 ######
    cd ~/home/user
    Create file android_device_reset and add:

    #!/bin/bash
    # android_device_reset script
    sudo adb kill-server
    sudo service udev stop
    sudo adb start-server
    sudo adb devices

    Close file and execute: chmod +x android_device_reset

    Insert the phone’s USB cable
    Create file /etc/udev/rules.d/51-android.rules, if there is no. And add

    SUBSYSTEMS==”usb”, SYSFS{idVendor}==”XXXX”, MODE==”0666″
    SUBSYSTEMS==”usb”, SYSFS{idVendor}==”XXXX”, MODE==”0666″

    After execute the command: lsusb
    Replace ID xxxx:xxxx in the file 51-android.rules following the sequence. save and close file.

    cd ~/home/user and execute the command: ./android_device_reset

    Remove and replace the phone’s USB cable. Done now open the eclipse.

    I hope this helps someone.

Leave a Reply

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