Ubuntu: debugging an Android device

I have an HTC Desire that I would like to debug and run an Android app. But when I get a window in Eclipse where I can choose between devices, my HTC Desire is listed only with question marks (????????). What am I doing wrong?

I tried this:

USB debugging is enabled on my device and debugging is enabled in the Manifest.xml file of the application.

In the terminal, I do this:

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

What else could I try or forget?

+24
android linux ubuntu adb
Jun 27. '10 at 13:49 on
source share
6 answers

You need to run adb manually using sudo. If you just run adb without sudo (or if you allow Eclipse / ADT to do this for you), it will not have the rights necessary to view your devices.

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

+49
Jun 28 2018-10-10T00:
source share

Note: EboMike's accepted answer is WRONG.

I know this is an old question, but I came across it trying to solve the same problem. However, the accepted answer was incorrect. You won’t need to run the adb server as root once you have set the udev rules correctly.

Step 3 at http://developer.android.com/tools/device.html gives the correct permission. In particular, 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 identifier for HTC. 0fff is the product identifier for the Nexus One. Use the table in the link above or lsusb to identify the device provider identifier and product identifier. eg,

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

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

 udevadm control --reload-rules 

If you needed to add yourself to the group, you will need to log out and log back in.

Kill all old adb servers with "adb kill-server", connect your device and run "adb devices". This will restart the server, and you should now see your device. Running adb as root, even to run the adb server, is not required. It is also usually a bad idea to run things as root if absolutely necessary.

+42
Jan 6 '13 at 19:48
source share

the device id in the adb devices message actually uses the serial number of usb devices for Android.

So, if you get an empty string from the serial number, it will display ????????????

In 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 = "????????????"; 

Thus, it may be that your adb server is not running as root, or your usb devices do not allow the adb server to be read. A simple check will use lsusb -v | grep iSerial to find out if you can get the iSerial field of your Android device.

In addition, there is a possibility that the iSerial string will not be well prepared on the device. I have seen that many engineering products do not have iSerial at all, or all devices display the same device identifier.

Several times the driver reads the data section in the flash, which is programmed uniquely from device to device to make it an iSerial / id device.

+3
Jun 18 '14 at 8:55
source share

I managed to launch my β€œbrick” Nexus S again, doing what is said here. However, a small small addition was needed.

When you execute lsusb and the USB subsystem tells you which Android device is connected, my email returned me:

 $ lsusb Bus 001 Device 006: ID 18d1:d001 Google Inc. 

Pay attention to d001 , and not to any of the known states, i.e. 4e20, 4e21, or 4e22. So what I did was add another line to 51-android.rules specifically with this unknown state and mark it as "restore / debug".

Unplug and reconnect Android. Check lsusb again to make sure it is at least seen. And ... It gave me this

 $ adb devices List of devices attached 34353601BB2000EC recovery 

instead of this

 $ adb devices -l List of devices attached ???????????? no permissions usb:1-3 

After that, I just followed the instructions to restore factory images . Hope this helps.

+2
Jun 23 '13 at 11:12
source share

This is because you did not give your adb permission to access your equipment. You have two solutions:

temporary -> kill all existing adb processes and restart using superuser

 ps -ef | grep adb | awk '{print $2}' | xargs kill sudo adb server-restart 

or

 sudo <your android SDK path>/platform-tools/adb server-restart 

permanent β†’ add your devices to the udev list Add the following line to your /etc/udev/rules.d/51-android.rules as root with the correct idVendor using this list .

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

and then the following command:

 chmod a+r /etc/udev/rules.d/51-android.rules 

If adb does not work, follow these steps:

 sudo ln -s <your android SDK path>/platform-tools/adb /usr/local/sbin/adb 
+1
Oct 25 '15 at 2:00
source share

Make sure you install sudo apt-get install android-tools-adb Now check sudo adb It will show adb help

Now, please remove / run adb using the following commands -

sudo adb kill-server sudo adb start-server

Finally, sudo adb devices

Hope it works !!!

0
Apr 10 '15 at 11:42
source share



All Articles