Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ubuntu: Android device debug [duplicate]

I have a HTC Desire which i would like to debug and run my Android application on. But when i in Eclipse gets the Window where i can choose between devices my HTC Desire is listed with only questionmarks (????????). What am i doing wrong?

I have tried this:

Enabled USB Debugging on my device and enabled debugging in my application Manifest.xml file.

In Terminal i have do this:

  1. Log in as root and create this file: /etc/udev/rules.d/51-android.rules.
  2. SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
  3. sudo service udev restart

What else could i try or have forgotten?

like image 968
Poku Avatar asked Jun 27 '10 13:06

Poku


3 Answers

You need to run adb manually using sudo. If you just run adb without sudo (or if you let Eclipse/ADT do it for you), it won't have the permissions necessary to see your devices.

If it's already running, then sudo adb kill-server and sudo adb start-server.

like image 52
EboMike Avatar answered Oct 04 '22 21:10

EboMike


Note: EboMike's accepted answer is INCORRECT.

I know this is an old question thread, but I stumbled across it trying to resolve the same problem. However the accepted answer was incorrect. There should be no need to run the adb server as root once you have your udev rules set correctly.

Step 3 in http://developer.android.com/tools/device.html gives you the correct resolution. Specifically, add or modify /etc/udev/rules.d/51-android.rules with the following line:

SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0fff", MODE="0666", GROUP="plugdev" 

In this case 0bb4 is the vendor id for HTC. 0fff is the product id for Nexus One. Use the table at the above link, or lsusb to identify your device's vendor id & product id. eg

$ lsusb
Bus 001 Device 006: ID 18d1:4e22 Google Inc. Nexus S (debug)

18d1 is the vendor id of this particular device, and 4e22 the product id. You can leave off the "GROUP" definition if you want to enable access to this device to all users. If not, be sure to add yourself to the plugdev group if you are not in it already. After creating this file, restart or reload udev.

udevadm control --reload-rules

If you had to add yourself to a group, you will need to logout and back in again.

Kill any old adb servers with "adb kill-server", plug your device in and run "adb devices". This will restart the server and you should now see your device. Running adb as root, even just to start the adb server, is not required. It is also generally a bad idea to run things as root unless it is absolutely required.

like image 21
gnac Avatar answered Oct 04 '22 21:10

gnac


the device-id in the adb devices commmand is actually using the serial number of the android usb devices.

So, if you get a null string from the serial number, it will display ???????????

In the adb server source code:

static size_t format_transport(atransport *t, char *buf, size_t bufsize,
                               int long_listing)
{
    const char* serial = t->serial;
    if (!serial || !serial[0])
        serial = "????????????";

So, it could be that your adb server is not running at root privilege, or your usb devices does't not allow adb server to read. A simple check would be using lsusb -v | grep iSerial to see if you can get the iSerial field of your android device.

Also, there're chances the iSerial string is not prepared well in the device. I've seen a lot of engineering product doesn't have the iSerial at all, or all of the devices are displaying the same device id.

Some times, the driver will read a section of data in the flash which is programmed uniquely from device to device to make it iSerial/device id.

like image 41
Rocky Zhang Avatar answered Oct 04 '22 21:10

Rocky Zhang