adb调试工具 MAC连接安卓虚拟机

环境配置

安卓虚拟机连接调试工具:adb

下载platform-tools 工具包后,
下载地址:https://pan.baidu.com/s/1iHjj87629-vgK_VRybBxPw 密码: w264

把platform目录添加到环境变量里

打开mac的终端,

open -e .bash_profile

adb调试工具 MAC连接安卓虚拟机_第1张图片

添加目录,
export PATH=“/Users/wangxianghua/anaconda2/bin:$PATH” 添加platform-tools/目录成为
export PATH=“/Users/wangxianghua/anaconda2/bin:/Users/wangxianghua/Downloads/platform-tools/:$PATH”
注意platform-tools后面有斜杠/,一开始没有加入斜杠,尝试了很多别的办法。

然后

source .bash_profile

此时终端,输入adb,不再提示command not found: adb

开始提示使用方法

adb
Android Debug Bridge version 1.0.39

Revision 3db08f2c6889-android

Installed as /Users/wangxianghua/Downloads/platform-tools//adb

global options:

-a         listen on all network interfaces, not just localhost

-d         use USB device (error if multiple devices connected)

-e         use TCP/IP device (error if multiple TCP/IP devices available)

-s SERIAL

     use device with given serial number (overrides $ANDROID_SERIAL)

-p PRODUCT

连接到安卓虚拟机

1.adb connect 101.236.31.X

显示

* daemon not running. starting it now at tcp:5037 *

* daemon started successfully *

connected to 101.236.31.X:5555

2.adb shell

显示

shell@remix_x86_64:/ $

3.切换成root

显示

shell@remix_x86_64:/ $ su

root@remix_x86_64:/ # 

4.安卓虚拟机修改DNS

adb shell 里用 root 权限,执行
ndc resolver setnetdns 100 localdomain [119.29.29.29](http://119.29.29.29/) [114.114.114.114](http://114.114.114.114/)

最好写入启动文件,不然重启 DNS 会仍然无效 /system/etc/init.sh

你可能感兴趣的:(adb调试工具 MAC连接安卓虚拟机)