如何在ubuntu下使用adb连接android设备

其他可能在ubuntu linux下遇到adb调试问题.

症状是usb连接的Android设备的可用性,例如与日食.
你可以测试一下

adb usb

当你拿到时

error: insufficient permissions for device

你可能遇到像我这样的问题.
但是,我在互联网上发现了一些或多或少的次优解决方

基本思路是以root身份启动adb.我发现的解决方案很麻烦.

一个建议是每个sudo启动adb.另一个建议是在/etc/init.d中设置启动脚本

我的解决方案是授予adb以root身份启动的权限.为此,请切换到root

sudo bash
chown root adb
chmod ug+s-w adb

安全狂热分子可能会提议

sudo chown root adb
sudo chmod ug+s-w adb

如果adb已经在运行,你需要杀死恶魔以root权限开始

adb kill-server

一切顺利

adb usb

应该回来

restarting in USB mode

如果没有,请尝试lsusb检查您的设备是否已连接

谷歌建议的处理ADB设备权限的方法是创建一个UDEV规则,该规则将设置适当的设备枚举权限.

按照http://developer.android.com/tools/device.html

If you’re developing on Ubuntu Linux,you need to add a udev rules
file that contains a USB configuration for each type of device you
want to use for development. In the rules file,each device
manufacturer is identified by a unique vendor ID,as specified by the
ATTR{idvendor} property. For a list of vendor IDs,see USB vendor IDs,
below. To set up device detection on Ubuntu Linux: Log in as root and
create this file: /etc/udev/rules.d/51-android.rules. Use this format
to add each vendor to the file: SUBSYstem==”usb”,
ATTR{idvendor}==”0bb4″,MODE=”0666″,GROUP=”plugdev”

In this example,the vendor ID is for HTC. The MODE assignment specifies read/write permissions,and GROUP defines which Unix group owns the device node. Note: The rule Syntax may vary slightly depending on your environment. Consult the udev documentation for your system as needed. For an overview of rule Syntax,see this guide to writing udev rules. Now execute: chmod a+r /etc/udev/rules.d/51-android.rules When plugged in over USB,can verify that your device is connected by executing adb devices from your SDK platform-tools/ directory. If connected,you’ll see the device name listed as a “device.”

相关文章

目录前言一、创建Hadoop用户二、更新apt和安装Vim编辑器三、...
原文连接:https://www.cnblogs.com/yasmi/p/5192694.html ...
电脑重启后,打开VirtualBox,发现一直用的虚拟机莫名的消失...
参见:https://blog.csdn.net/weixin_38883338/article/deta...
Ubuntu 18.04 LTS 已切换到 Netplan 来配置网络接口。Netpla...
介绍每个 Web 服务都可以通过特定的 URL 在 Internet 上访问...