新搭建的Ubuntu开发环境,用adb连接开发板,提示权限不足,缺少udev规则
(adb: insufficient permissions for device: missing udev rules? user is in the plugdev group)。
这个问题也会影响scrcpy的使用。
$ adb devices
List of devices attached
4a093191 no permissions (missing udev rules? user is in the plugdev group); see [http://developer.android.com/tools/device.html]
$ adb shell
adb: insufficient permissions for device: missing udev rules? user is in the plugdev group
See [http://developer.android.com/tools/device.html] for more information
参照Google的官方说明,在Ubuntu上使用adb前提:
1)当前登录用户在plugdev群组中。
(a)查看当前用户所在群组(当前用户名为dev):
$ id
uid=1000(dev) gid=1000(dev) groups=1000(dev),4(adm),27(sudo),30(dip),46(plugdev),116(lpadmin),126(sambashare)
说明:当前用户已经包含的plugdev群组中,上面输出结果中可以看到46(plugdev)。
(b)如果没有包含,把当前用户增加到群组中:
$ sudo usermod -aG plugdev $LOGNAME
注意:需要注销或重启群组变更才能生效。并再次通过id命令查看确认。
2)需要为设备增加udev rule。
(1)使用开源社区的udev规则安装包。
$ sudo apt-get install android-sdk-platform-tools-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
android-sdk-platform-tools-common
0 upgraded, 1 newly installed, 0 to remove and 484 not upgraded.
Need to get 12.2 kB of archives.
After this operation, 50.2 kB of additional disk space will be used.
Get:1 http://mirrors.aliyun.com/ubuntu bionic-security/universe amd64 android-sdk-platform-tools-common all 27.0.0+10~18.04.2 [12.2 kB]
Fetched 12.2 kB in 0s (70.2 kB/s)
Selecting previously unselected package android-sdk-platform-tools-common.
(Reading database ... 174139 files and directories currently installed.)
Preparing to unpack .../android-sdk-platform-tools-common_27.0.0+10~18.04.2_all.deb ...
Unpacking android-sdk-platform-tools-common (27.0.0+10~18.04.2) ...
Setting up android-sdk-platform-tools-common (27.0.0+10~18.04.2) ...
操作完成后(注意需要注销或者重启的步骤,保险起见可以操作完了重启一次系统),再次使用adb命令,可以正常连接开发板。
(2) 手动创建rule文件。
创建dev rule文件:/etc/udev/rules.d/51-android.rules(需要sudo),内容如下:文章来源:https://www.toymoban.com/news/detail-626512.html
$ cat /etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb", MODE="0660", GROUP="plugdev", SYMLINK+="android%n"
编辑完成后,重新插拔手机或者开发板的usb线即可生效。
再次使用adb命令,没有缺少权限的提示信息。文章来源地址https://www.toymoban.com/news/detail-626512.html
$ adb devices
List of devices attached
4a093191 device
到了这里,关于Ubuntu上adb命令提示权限不足,缺少udev rules(adb: insufficient permissions for device: missing udev rules? )的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!