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

前端之家收集整理的这篇文章主要介绍了如何在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.f2er.com/ubuntu/347477.html

猜你在找的Ubuntu相关文章