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

[ubuntu][android][adb]no permissions (udev requires plugdev group membership)

在 ubuntu 1404 64位機終端上輸入 adb devices

顯示如下的不愉快:

0123456789ABCDEF no permissions (udev requires plugdev group membership); see [http://developer.android.com/tools/device.html]


這會導致無法測試 CTS 和 GTS。查找 android 官方資料,解決方法如下:


1. 終端 輸入命令: lsusb

Bus 002 Device 003: ID 046d:c05a Logitech,Inc. M90/M100 Optical Mouse
Bus 002 Device 002: ID 8087:8000 Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 125: ID 0e8d:200a MediaTek Inc.
Bus 001 Device 002: ID 8087:8008 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

找到手機對應的那一行,這裡是

Bus 001 Device 125: ID 0e8d:200a MediaTek Inc.


2. 然後

vim /etc/udev/rules.d/51-android.rules

添加以下這行到文件中:

SUBSYstem=="usb",ATTR{idvendor}=="0e8d",MODE="200a",GROUP="plugdev"

3. 再執行

chmod a+r /etc/udev/rules.d/51-android.rules

4. 再執行以下命令

adb kill-server

adb devices 

就顯示如下的了:

List of devices attached
0123456789ABCDEF device



[參考]:

https://developer.android.com/studio/run/device.html#developer-device-options

內容複製如下:


Skip to content
Android Studio

Features User Guide

navigation
User Guide

Meet Android Studio
Workflow Basics
Manage Your Project
Write Your App
Build and Run Your App
Run Apps on the Emulator
Run Apps on a Hardware Device
Install OEM USB Drivers
Get the Google USB Driver
Create Run/Debug Configurations
Build Your App from the Command Line
Configure Your Build
Debug Your App
Test Your App
Profile Your App
Publish Your App
Command Line Tools
Release Notes
Troubleshoot

Back to Developers
Download
Features
User Guide

Run Apps on a Hardware Device
In this document

Enabling On-device Developer Options
Setting up a Device for Development
USB vendor IDs

See also

Install USB Drivers
Google USB Driver

When building an Android app,it's important that you always test your application on a real device before releasing it to users. This page describes how to set up your development environment and Android-powered device for testing and debugging on the device.

You can use any Android-powered device as an environment for running,debugging,and testing your applications. The tools included in the SDK make it easy to install and run your application on the device each time you compile. You can install your application on the device directly from Android Studio or from the command line with ADB. If you don't yet have a device,check with the service providers in your area to determine which Android-powered devices are available.

If you want a SIM-unlocked phone,then you might consider a Nexus phone. To purchase a Nexus phone,visit the Google Play store.

Note: When developing on a device,keep in mind that you should still use the Android emulator to test your application on configurations that are not equivalent to those of your real device. Although the emulator does not allow you to test every device feature,it does allow you to verify that your application functions properly on different versions of the Android platform,in different screen sizes and orientations,and more.
Enabling On-device Developer Options

Android-powered devices have a host of developer options that you can access on the phone,which let you:

Enable debugging over USB.
Quickly capture bug reports onto the device.
Show cpu usage on screen.
Draw debugging information on screen such as layout bounds,updates on GPU views and hardware layers,and other information.
Plus many more options to simulate app stresses or enable debugging options.

To access these settings,open the Developer options in the system Settings. On Android 4.2 and higher,the Developer options screen is hidden by default. To make it visible,go to Settings > About phone and tap Build number seven times. Return to the prevIoUs screen to find Developer options at the bottom.
Setting up a Device for Development

With an Android-powered device,you can develop and debug your Android applications just as you would on the emulator. Before you can start,there are just a few things to do:

Verify that your application is "debuggable" in your manifest or build.gradle file.

In the build file,make sure the debuggable property in the debug build type is set to true. The build type property overrides the manifest setting.

android {
buildTypes {
debug {
debuggable true
}

In the AndroidManifest.xml file,add android:debuggable="true" to the <application> element.

Note: If you manually enable debugging in the manifest file,be sure to disable it in your release build (your published application should usually not be debuggable).
Enable USB debugging in the device system settings,under Settings > Developer options.

Note: On Android 4.2 and newer,Developer options is hidden by default. To make it available,go to Settings > About phone and tap Build number seven times. Return to the prevIoUs screen to find Developer options.
Set up your system to detect your device.
If you're developing on Windows,you need to install a USB driver for adb. For an installation guide and links to OEM drivers,see the OEM USB Drivers document.
If you're developing on Mac OS X,it just works. Skip this step.
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

Note: When you connect a device running Android 4.2.2 or higher to your computer,the system shows a dialog asking whether to accept an RSA key that allows debugging through this computer. This security mechanism protects user devices because it ensures that USB debugging and other adb commands cannot be executed unless you're able to unlock the device and ackNowledge the dialog. This requires that you have adb version 1.0.31 (available with SDK Platform-tools r16.0.1 and higher) in order to debug on a device running Android 4.2.2 or higher.

When plugged in over USB,you 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."

If using Android Studio,run or debug your application as usual. You will be presented with a Device Chooser dialog that lists the available emulator(s) and connected device(s). Select the device upon which you want to install and run the application.

If using the Android Debug Bridge (adb),you can issue commands with the -d flag to target your connected device.
USB vendor IDs

This table provides a reference to the vendor IDs needed in order to add USB device support on Linux. The USB vendor ID is the value given to the ATTR{idvendor} property in the rules file,as described above.
Company USB vendor ID
Acer 0502
ASUS 0b05
Dell 413c
Foxconn 0489
Fujitsu 04c5
Fujitsu Toshiba 04c5
Garmin-Asus 091e
Google 18d1
Haier 201E
Hisense 109b
HP 03f0
HTC 0bb4
Huawei 12d1
Intel 8087
K-Touch 24e3
KT Tech 2116
Kyocera 0482
Lenovo 17ef
LG 1004
Motorola 22b8
MTK 0e8d
NEC 0409
Nook 2080
Nvidia 0955
OTGV 2257
Pantech 10a9
Pegatron 1d4d
Philips 0471
PMC-Sierra 04da
Qualcomm 05c6
SK Telesys 1f53
Samsung 04e8
Sharp 04dd
Sony 054c
Sony Ericsson 0fce
Sony Mobile Communications 0fce
Teleepoch 2340
Toshiba 0930
ZTE 19d2
Get news & tips
Blog Support

Except as noted,this content is licensed under Creative Commons Attribution 2.5. For details and restrictions,see the Content License.

About Android Auto TV Wear Legal
This site uses cookies to store your preferences for site-specific language and display options.

Take a one-minute survey?
Help us improve Android tools and documentation.


[EndByChampWang][20161212]

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

相关推荐


目录前言一、创建Hadoop用户二、更新apt和安装Vim编辑器三、安装SSH和配置SSH无密码登录四、安装Java环境1. 安装JDK2. 配置JDK环境3. 检验安装五、安装单机Hadoop1. 下载安装Hadoop2. 运行示例总结前言本文安装的 Hadoop 及 Java 环境基于林子雨老师的《大数据技术原理与应用(第3版)》中所要求,其中Java 版本为1.8.0_301,Hadoop 版本为3.3.1,其他版本的安装请参考其他博客。..
原文连接:https://www.cnblogs.com/yasmi/p/5192694.html  运行django出现错误信息:[2016-02-16 14:33:24,476 pyinotify ERROR] add_watch: cannot watch /usr/local/lib/python2.7/dist-packages/django/contrib/sessio...
电脑重启后,打开VirtualBox,发现一直用的虚拟机莫名的消失了,如下:别着急,以下教你如何找回之前的虚拟机:1、点击控制,然后选择注册,找到虚拟机的安装目录,比如:C:UserstxVirtualBox VMs,然后选择需要找回的虚拟机vbox,点击打开按钮即可:2、如果打开后报错,则执行第三步:3、删除ubuntu.vbox,然后将ubuntu.vbox-prev重命名为ubuntu.vbox,然后再执行第二步即可...
参见:https://blog.csdn.net/weixin_38883338/article/details/82153933 https://blog.csdn.net/github_39533414/article/details/85211012
Ubuntu 18.04 LTS 已切换到 Netplan 来配置网络接口。Netplan 基于 YAML 的配置系统,使得配置过程非常简单。Netplan 替换了我们之前在 Ubuntu 中用于配置网络接口的旧配置文件/etc/network/interfaces。在本文中,我们将学习如何使用 Netplan 在 Ubuntu 中配置网络。我们将看到静态和动态 IP 配置。我将使用 Ubuntu 18.04 LTS 来描述本文中提到的过程。使用 Netplan 配置网络您可以在/etc
介绍每个 Web 服务都可以通过特定的 URL 在 Internet 上访问,该 URL 代表一种“替代名称”,用于标识提供该服务的服务器的 IP 地址和端口。同一台机器可以同时在不同的端口上提供不同的服务。出于安全原因,可能需要屏蔽 Web 服务的端口号,从而在外部显示与服务实际侦听的端口号不对应的端口号。感谢本教程,您将能够管理您的服务器端口,配置集成在 Ubuntu 中的 UFW 防火墙。特别是,按照指南的说明,您将学习将来自某个端口的请求转发到另一个端口(端口转发),同时使用后者提供的.
Observium 是一个免费和开源的 sa 网络管理和监控系统工具。我们可以使用 SNMP 收集数据,它允许监控所有网络设备。它提供了一个简单易用的 Web 界面。它基于 PHP 并使用 MySQL 数据库来存储数据。在 ubuntu 上设置 Observium 有几个步骤:第 1 步:更新系统。apt-get update第 2 步:安装 PHP 和模块。apt install wget apache2 php php-{pear,cgi,common,curl,mbstring,g
从 20.04 开始,Ubuntu 决定更新实时服务器安装程序以实现自动安装规范,以便能够仅使用 Subiquity 完全自动化安装过程。Subiquity 是新的服务器安装程序(又名“服务器无处不在”),旨在取代之前基于 debian-installer 的经典系统。本文说明了如何使用 Packer 和 Proxmox 上的 Subiquity 生成 Ubuntu Server 20.04 图像模板。介绍Subiquity 仅在live图像文件版本中可用(例如ubuntu-20.0...
Ubuntu 将停止支持 Debian 安装程序(预置)。Ubuntu Server 20.04 附带了一种新的自动化操作系统安装方法,称为带有 subiquity 服务器安装程序的自动安装。这篇文章展示了使用新安装程序构建的打包程序。此设置仅适用于 Ubuntu-20.04 live-server 而不是旧版。SubiquitySubiquity 是 Ubuntu 服务器的新自动安装程序,它是在 18.04 中引入的。自动安装的设置由 cloud-init 配置提供。如果设置,将从配置文件.
此页面的目的是提供在您机器上的 VM 中执行自动安装的简单说明。此页面假设您使用的是 amd64 架构。s390x也有一个版本。通过网络提供自动安装数据这种方法是最容易推广到完全基于网络的安装的方法,在这种安装中,机器会进行网络引导,然后自动安装。下载 ISO转到20.04 ISO 下载页面并下载最新的 Ubuntu 20.04 实时服务器 ISO。挂载 ISOsudo mount -r ~/Downloads/ubuntu-20.04-live-server-amd64...