美文网首页
Linux系统安装adb

Linux系统安装adb

作者: rr1990 | 来源:发表于2019-01-14 14:19 被阅读0次

    一、查看adb版本

    查看系统是否安装有adb
    qyh@ubuntu:~$ adb
    The program 'adb' is currently not installed. You can install it by typing:
    sudo apt-get install android-tools-adb
    

    二、通过apt-get安装adb

    1. 安装adb
    qyh@ubuntu:~$ sudo apt-get install android-tools-adb
    [sudo] password for qyh: 
    Reading package lists... Done
    ...
    
    2. 查看adb是否安装成功
    qyh@ubuntu:~$ adb version
    Android Debug Bridge version 1.0.31
    

    三、adb devices操作

    1. 异常问题:adb devices时提示no permissinons
    qyh@ubuntu:~$ adb devices
    List of devices attached 
    ????????????    no permissions
    
    解决方案:

    (1)通过lsusb查看usb设备

    qyh@ubuntu:~$ lsusb
    Bus 001 Device 003: ID 0e8d:2003 MediaTek Inc. 
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
    Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
    Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    

    获取所连的mtk android设备的usb信息为:
    Bus 001 Device 003: ID 0e8d:2003 MediaTek Inc.
    所需连的设备id为:0e8d,idProduct为:2003
    (2)在/etc/udev/rules.d/...目录下添加设备信息

    #查看/etc/udev/rules.d/目录下文件
    qyh@ubuntu:~$ ls /etc/udev/rules.d/
    99-vmware-scsi-udev.rules  README
    #在99-vmware-scsi-udev.rules后追加设备信息(也可新建一个rules添加设备信息,具体新建的rules名称规则可查看README)
    qyh@ubuntu:~$ sudo gedit /etc/udev/rules.d/99-vmware-scsi-udev.rules 
    #在文件99-vmware-scsi-udev.rules后面追加以下内容
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="2003",MODE="0666"
    

    (3)重启udev

    qyh@ubuntu:~$ sudo chmod a+rx /etc/udev/rules.d/99-vmware-scsi-udev.rules 
    qyh@ubuntu:~$ sudo service udev restart 
    udev stop/waiting
    udev start/running, process 2774
    

    (4)拔除USB后进行adb kill-server等操作

    qyh@ubuntu:~$ adb kill-server
    qyh@ubuntu:~$ adb start-server
    * daemon not running. starting it now on port 5037 *
    * daemon started successfully *
    qyh@ubuntu:~$ adb devices
    List of devices attached 
    
    

    结果adb devices无设备信息显示

    2. 异常问题:adb devices时无设备信息显示
    qyh@ubuntu:~$ adb devices
    List of devices attached 
    
    
    解决方案:

    (1)在根目录.android目录下编辑文件adb_usb.ini,添加设备id号
    如,通过lsusb查看的id号为0e8d,故添加内容0x0e8d

    qyh@ubuntu:~$ sudo gedit ~/.android/adb_usb.ini
    

    (2)进行adb kill-server等操作

    qyh@ubuntu:~$ adb kill-server
    qyh@ubuntu:~$ adb devices
    * daemon not running. starting it now on port 5037 *
    * daemon started successfully *
    List of devices attached 
    106XXXX device
    

    相关文章

      网友评论

          本文标题:Linux系统安装adb

          本文链接:https://www.haomeiwen.com/subject/dmqwkqtx.html