• ubuntu linux adb devices no permissions解决办法


      最近在调试安卓手机时老是失败,问题如下所示  

    han@ubuntu:~/project/zero_app$ adb devices
    List of devices attached
    664768297cf5    no permissions (user in plugdev group; are your udev rules wrong?); see [http://developer.android.com/tools/device.html]
    

      

      在网上查资料得知,安卓手机连接到电脑开发,在windows环境下,需要为adb安装usb驱动,每个手机厂商一般提供的对应的windows usb驱动程序,咱们下载安装之后可以连接了.在mac os环境下,只要你数据线不坏就行,插着就不用管了(是不是很方便).

      最后来说下在ubuntu linux环境下,则需要为开发中的每一种设备添加一个包含usb配置的udev规则文件.在规则文件下,每一个设备制造商都提供一个唯一的供应商id属性所标识.我们需要手动编辑这个文件(没有就创建),将SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev" (本例中,供应商id为HTC厂商的id: 0bb4, 读写权限为: 0666, GROUP则定义那个Unix组拥有设备节点),添加到规则文件中去:

    han@ubuntu:~$ sudo gedit /etc/udev/rules.d/51-android.rules
    

      我在android developer没有找到小米,很是伤心...后来查到,linux下有个命令 lsusb 可以查看usb设备和他的属性.

    han@ubuntu:~$ lsusb
    Bus 002 Device 002: ID 0451:8046 Texas Instruments, Inc. 
    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 001 Device 005: ID 413c:301a Dell Computer Corp. 
    Bus 001 Device 003: ID 413c:2113 Dell Computer Corp. 
    Bus 001 Device 009: ID 18d1:4ee7 Google Inc. 
    Bus 001 Device 002: ID 0451:8044 Texas Instruments, Inc. 
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    

      下面介绍以我的小米为例,介绍下输出的含义(第一个)

    • Bus 002: 指明设备连接到哪条总线
    • Device 002: 表明这是连接到总线上的第二台设备
    • ID 0451:8046: 设备的id, 0451 就是我们需要的供应商id
    • Texas Instruments, Inc: 生产商名字,这个是德州仪器

      规则文件修改后,执行

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

      最后,重新拔插下手机,命令行输入adb devices

    han@ubuntu:~/project/zero_app$ adb devices
    List of devices attached
    664768297cf5    device
    

      好了,大功告成.

  • 相关阅读:
    弹性计算双周刊 第24期
    【阿里云新品发布·周刊】第8期:数字化风暴已经来临!云+区块链,如何颠覆未来科技?
    洞见数据库前沿 阿里云数据库最强阵容 DTCC 2019 八大亮点抢先看
    开发者招聘节 | 2019阿里巴巴技术面试题分享(陆续放出)
    bzoj1856: [Scoi2010]字符串
    bzoj1257: [CQOI2007]余数之和sum
    bzoj1088: [SCOI2005]扫雷Mine
    noip2015 运输计划
    noip2015 子串
    noip2015 斗地主
  • 原文地址:https://www.cnblogs.com/hanshuai/p/9511614.html
Copyright © 2020-2023  润新知