在linux下android开发,我经常遇到usb调试时,手机无法识别
$ adb devices
List of devices attached
???????????? no permissions 本质上是adb server启动需要权限造成的,可以用以下的方法来解决问题。
解决方法:
1)断开手机连接先执行
$ lsusb
Bus 002 Device 002: ID 8087:8000 Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 006: ID 0cf3:3004 Atheros Communications, Inc.
Bus 003 Device 003: ID 040b:2013 Weltrend Semiconductor
Bus 003 Device 002: ID 174f:1474 Syntek
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub 连接手机,再执行一次lsusb
Bus 002 Device 002: ID 8087:8000 Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 006: ID 0cf3:3004 Atheros Communications, Inc.
Bus 003 Device 009: ID 18d1:9025 Google Inc.
Bus 003 Device 003: ID 040b:2013 Weltrend Semiconductor
Bus 003 Device 002: ID 174f:1474 Syntek
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
那多出来的Bus 003 Device 009: ID 18d1:9025 Google Inc. 就是你的手机。
使用 vim 新建一个配置文件
$ sudo vim /etc/udev/rules.d/70-android.rules 内容填写如下
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="9025",MODE="0666" ##修改18d1和9025,把他改成你的设备##
运行以下命令:
sudo chmod a+rx /etc/udev/rules.d/70-android.rules
sudo /etc/init.d/udev restart 在 Android sdk 的 tools 目录下运行 (这一步很重要,必须要sudo,否则没效果)
sudo adb kill-server sudo adb start-server sudo adb devices修改完成后,将手机USB线与电脑断开,再连就会显示
$ sudo adb devices
List of devices attached
1234567890ABCDEF device
本文详细介绍了在Linux环境下解决Android开发过程中USB调试时手机无法识别的问题,通过执行一系列命令和配置文件操作,最终成功解决了设备识别问题。包括使用lsusb检查设备、创建并编辑配置文件、重启udev服务以及重启ADB服务等步骤。
875

被折叠的 条评论
为什么被折叠?



