Category Archives: android

Fix adb devices android adb device not found

ISSUES: 小米手机 usb 连接 adb debug 没反应.(adb devices 提示找不到设备或是没有权限)

$ adb devices get the following messages:

- waiting for device -

adb kill-server
adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached

Detect your device USB ID by lsusb

idVendor:idProduct

lsusb
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 003 Device 027: ID 2717:9039  
Bus 003 Device 003: ID 04f2:b327 Chicony Electronics Co., Ltd 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
.....

If cannot identity by name string, we can diff the results by plugin USB on/off of your device.

Set up your system to detect your device

The fix is mentioned on the setup page I mentioned previously.

Create a file called something like /etc/udev/rules.d/99-android.rules that contains rules telling udev to make the device node world-writable when a matching device is found.

sudo vi /etc/udev/rules.d/99-android.rules

SUBSYSTEMS=="usb", ATTRS{idVendor}=="2717", ATTRS{idProduct}=="9039", MODE="0666", OWNER="allex"

For simplicity, you could specify “*” for ATTRS so that all devices can be used

SUBSYSTEMS=="usb", ATTRS{idVendor}=="*", ATTRS{idProduct}=="*", MODE="0666", OWNER="your_name"

Manually update vendor ID to ~/.android/adb_usb.ini

If adb still cannot detect your device. the solution is that the ADB daemon needs also your USB device vendor ID (VID)

mkdir ~/.android/
echo 0x2717 > ~/.android/adb_usb.ini # 其中 0x2717 是通过 lsusb 得到的 VendorId

For more VID please see also at adbusb.ini and the Linux USB listing at http://www.linux-usb.org/usb.ids

Restart udev and adb services

sudo restart udev
adb kill-server && adb start-server
    
adb devices
List of devices attached 
66c95e6 device

DONE!

Enjoy android develops with adb logcat