Ubuntu adb 报错:no permissions (user in plugdev group; are your udev rules wrong?);

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

他会列出来所有的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

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页