zoukankan      html  css  js  c++  java
  • [ubuntu] win10中linux子系统增加adb调试功能

    转载请注明出处:https://www.cnblogs.com/lialong1st/p/12106396.html

    在Linux子系统中使用adb功能,有两种方式:

    1、使用Windows系统的adb

    2、在Linux子系统中安装Linux版本的adb

    一、使用Windows系统的adb,但adb后面会多.exe后缀

    使用前提是Windows下的adb已经可以正常使用,只需要将路径添加到Linux的PATH路径中即可

    如果在安装Ubuntu之前,已经将adb路径添加到Windows的path路径,则安装Ubuntu时也会自动将此路径添加到Ubunut的PATH路径,无需手动添加

    若安装Ubuntu之前没有添加,就需要按照下面方法添加:

    在Ubuntu中找到Windows下adb的路径。我的是c:/Android,Ubuntu中会自动挂载硬盘,所以前面会加/mnt

    将adb路径添加到Ubuntu的path路径

    $ export PATH=/mnt/c/Android:$PATH

    此时就能正常使用,输入adb按Tab键,就会自动补全adb.exe,调用Windows的adb工具。

    $ adb.exe version
    Android Debug Bridge version 1.0.39
    Version 0.0.1-4500957
    Installed as C:Androidadb.exe

    二、在Linux子系统中安装Linux版本的adb,使用与Windows完全相同

    1、在Linux子系统安装adb,会自动安装最新版本

    $ sudo apt install adb

    若安装报错:

    E: Could not read response to hello message from hook [ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt 2>/dev/null || true: Success

    执行下面指令
    $ sudo rm -rf /etc/apt/apt.conf.d/20snapd.conf

    再次安装成功
    $ sudo apt install adb

    查看安装的adb版本为1.0.39,路径为/usr/lib/android-sdk/platform-tools/adb

    $ adb version
    Android Debug Bridge version 1.0.39
    Version 1:8.1.0+r23-5~18.04
    Installed as /usr/lib/android-sdk/platform-tools/adb

    安装完成后,系统会自动将adb软链接到/usr/bin/adb,因为/usr/bin默认在path路径中,后面在任意路径都可随意使用adb

    $ ls -l /usr/bin/adb
    lrwxrwxrwx 1 root root 37 Mar 19 2019 /usr/bin/adb -> ../lib/android-sdk/platform-tools/adb

    2、在Windows下安装adb,版本必须要与linux版本号相同

    下载:https://dl.google.com/android/repository/platform-tools-latest-windows.zip

    查看adb版本号,与Linux子系统版本相同,最好也手动将adb添加到Windows的path路径

    C:Usersaaron>adb version
    Android Debug Bridge version 1.0.39
    Version 0.0.1-4500957
    Installed as C:Androidadb.exe

    若之前已经安装过其他版本的adb,此时运行新版本adb会找不到设备

    C:Usersaaron>adb shell

    先关闭adb服务

    C:Usersaaron>adb kill-server

    再打开adb服务

    C:Usersaaron>adb start-server

    此时adb就安装完成,在windows下就可以正常使用adb,再切换到linux子系统中,adb也可以正常使用。

    [Linux] 启用win10下Linux子系统

  • 相关阅读:
    7.3---直线是否相交(CC150)
    7.2---蚂蚁相遇问题(CC150)
    5.6---交换整数的奇数位和偶数位(CC150)
    5.5---整数A转成整数B(CC150)
    5.2---小数的二进制表示(CC150)
    5.1---二进制数插入(CC150)
    4.6---找二叉树中序后继(CC150)
    4.5---判断是否是二叉排序树BST(CC150)
    4.4---建立二叉树的链表
    linux中查看java进程
  • 原文地址:https://www.cnblogs.com/lialong1st/p/12106396.html
Copyright © 2011-2022 走看看