可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
This question already has an answer here:
-
set up device for development (???????????? no permissions)
23 answers
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:
- 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 have forgotten?
回答1:
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.
回答2:
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.
回答3:
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.
回答4:
I've managed to get my "bricked" Nexus S working again by doing what is said here.
One small addition was necessary, though.
When you do an lsusb
and the USB subsystem tells you which Android device is attached, mine was giving me back:
$ lsusb
Bus 001 Device 006: ID 18d1:d001 Google Inc.
Note the d001 and not any of the known states, i.e. 4e20, 4e21 or 4e22.
So what I did is to add another row in 51-android.rules
specifically with this unknown state and mark it as "recovery/debug".
Disconnect and reconnect Android. Check lsusb
again to make sure it is at least seen. And... That 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 simply followed the howto for restoring the factory images. Hope it helps.
回答5:
This is because you haven't given your adb the permission to access to your hardware.
You have two solutions:
temporary -> kill all existing adb processes and restart with super user
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 udev list
Add following line to your /etc/udev/rules.d/51-android.rules as root with correct idVendor using this list.
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"
followed by following command:
chmod a+r /etc/udev/rules.d/51-android.rules
If adb doesn't work do the following:
sudo ln -s <your android SDK path>/platform-tools/adb /usr/local/sbin/adb
回答6:
Make sure you installed
sudo apt-get install android-tools-adb
Now check
sudo adb
It will show help of adb
Now please kill/start adb use following commands -
sudo adb kill-server
sudo adb start-server
Lastly,
sudo adb devices
Hopefully this will work !!!