微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在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.”

原文地址:https://www.jb51.cc/ubuntu/347477.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐