Java教程

015、adb常用命令

本文主要是介绍015、adb常用命令,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

 

adb常用命令

1、安装配置jdk8,输入java -version ;
2、添加到系统变量的path中;输入adb version 显示版本号说明配置成功;
3、真机+usb线使用adb,打开usb调试模式,连接真机输入:adb devices,查看到手机序列号+devices 说明OK;
4、真机+局域网连接使用adb,同一个局域网,adb tcpip 5555监听一个端口,用手机的ip地址+端口adb connect 192.168.1.103:5555 进行连接,

  操作步骤:
  a、将 Android 设备与要运行 adb 的电脑连接到同一个局域网,比如连到同一个 WiFi;
  b、将设备与电脑通过 USB 线连接。
  c、应确保连接成功(可运行 adb devices 看是否能列出该设备)。
  d、让设备在 5555 端口监听 TCP/IP 连接,执行命令: adb tcpip 5555
  e、当出现 restarting in TCP mode port: 5555 断开 USB 连接 (如果是用下面的命令查看ip地址,等输入adb shell netcfg 后再把数据线)。
  f、找到设备的 IP 地址。 一般能在「设置」-「关于手机」-「状态信息」-「IP地址」找到,也可以使用命令:adb shell netcfg 查看,标记wlan0的就是
  g、通过 IP 地址+刚才的端口号连接设备执行命令: adb connect 192.168.1.103:5555
  h、 显示 connected to 192.168.1.103:5555 表示连接成功
  i、断开无线连接: adb disconnect 192.168.1.103:5555 ,在没有关机停止监听 5555 端口的情况下可以再执行 adb connect 192.168.1.103:5555 进行连接 ;
  如果只是断开一下WiFi连接,不需要adb connect 192.168.1.103:5555 再次连接,会自动连接

5、夜神模拟器使用adb,下载64位的夜神模拟器,用自己下载的adb.exe 重命名为nox_adb.exe 替换夜神模拟器中的adb,保证adb版本匹配;
  使用adb connect 127.0.0.1:59865 连接

6、adb常用命令如下:
  1、adb tcpip 5555(被监听的端口);
  2、adb connect 192.168.1.103:5555(远程连接);
  3、adb shell netcfg(查看网络地址);
  4、adb version;
  5、adb devices;
  6、adb shell ;登录手机设备;
  7、adb install 、adb uninstall、adb install -r(覆盖安装)
  8、adb -s 手机序列号,指定手机运行命令;
  9、adb logcat | find "wifi" (过滤日志,windows环境用find,linux环境可以用grep过滤)
  10、adb pull 从手机端把文件拉出来,adb push 把文件推送到手机端;
  11、adb shell input keyevent 26————按power键
  12、adb shell input text "123"——输入文本, adb shell input tap 100 100—— 输入坐标,adb shell input swipe 100 100 200 200 300——滑动,
  13、adb shell settings 对手机进行设置;

这篇关于015、adb常用命令的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!