参考链接:Ubuntu adb 报错:no permissions (user in plugdev group; are your udev rules wrong?);_小米科技Android 研发曹新雨的博客-CSDN博客

Ubuntu 下 adb 报错:

caoxinyu@caoxinyu-ThinkPad-T470p:~/Android/Sdk/platform-tools$ ./adb devices
List of devices attached
faf80ac1	no permissions (user in plugdev group; are your udev rules wrong?); see [http://developer.android.com/tools/device.html]


解决方案:
setp 1: lsusb 找到你手机的usb地址

caoxinyu@caoxinyu-ThinkPad-T470p:~/Android/Sdk/platform-tools$ lsusb
Bus 002 Device 002: ID 1f75:0621 Innostor Technology Corporation 
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 006: ID 0bda:58db Realtek Semiconductor Corp. 
Bus 001 Device 005: ID 8087:0a2b Intel Corp. 
Bus 001 Device 004: ID 138a:0097 Validity Sensors, Inc. 
Bus 001 Device 003: ID 18f8:0f99  
Bus 001 Device 014: ID 19d2:ffb0 ZTE WCDMA Technologies MSM 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

我在我的虚拟机的ubuntu21.10中照做:
student@student-virtual-machine:~$ lsusb
Bus 001 Device 002: ID 0e8d:201c MediaTek Inc. honor-x9
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
student@student-virtual-machine:~$ 


他会列出来所有的usb 设备,你找下。如果试下找不到,那么拔掉手机看下,哪了没有了就是哪个。

setp2: sudo gedit /etc/udev/rules.d/51-android.rules

caoxinyu@caoxinyu-ThinkPad-T470p:~/Android/Sdk/platform-tools$ sudo gedit /etc/udev/rules.d/51-android.rules
[sudo] password for caoxinyu: 

之后把这些文本copy 到 编辑器里面:

ATTR{idProduct}=="ffb0", SYMLINK+="android_adb", MODE="0660", GROUP="plugdev", TAG+="uaccess", SYMLINK+="android"

注意:ffb0 是你查找手机设备的usb 的地址。

Bus 001 Device 014: ID 19d2:ffb0 ZTE WCDMA Technologies MSM
改成你的地址。

如果没有/etc/udev/rules.d/51-android.rules 文件,麻烦自己创建一下。

setp3: 之后执行命令:

caoxinyu@caoxinyu-ThinkPad-T470p:~/Android/Sdk/platform-tools$ sudo usermod -a -G plugdev $(id -u -n)
caoxinyu@caoxinyu-ThinkPad-T470p:~/Android/Sdk/platform-tools$ sudo udevadm control --reload-rules
caoxinyu@caoxinyu-ThinkPad-T470p:~/Android/Sdk/platform-tools$ sudo service udev restart
caoxinyu@caoxinyu-ThinkPad-T470p:~/Android/Sdk/platform-tools$ sudo udevadm trigger


setp4: 之后重启adb

caoxinyu@caoxinyu-ThinkPad-T470p:~/Android/Sdk/platform-tools$ ./adb kill-server 
caoxinyu@caoxinyu-ThinkPad-T470p:~/Android/Sdk/platform-tools$ ./adb start-server
caoxinyu@caoxinyu-ThinkPad-T470p:~/Android/Sdk/platform-tools$ ./adb devices
List of devices attached
faf80ac1	unauthorized


参考:
https://developer.android.google.cn/studio/run/device#setting-up
————————————————
版权声明:本文为CSDN博主「小米科技Android 研发曹新雨」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/u013270444/article/details/88610554

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐