常用ADB命令汇总

网络连接

通过TCP/IP连接设备

adb connect <ip:port>

断开已有的TCP/IP连接

adb disconnect <ip:port>

监听设备上指定的端口号

adb tcpip <port> 

文件操作

拉取文件至本地

adb pull <文件的设备路径> <文件的本地路径> 

推动文件至设备

adb push <文件的本地路径> <文件的设备路径> 

调试相关

启动ADB服务

adb start-server 

关闭ADB服务

adb kill-server 

查看设备日志,具体参数可通过adb logcat --help查看

adb logcat <options> <filter> 

安装卸载

安装应用

adb install <options> <package>

卸载应用

adb uninstall <options> <package> 

性能相关

查看进程

adb shell ps  

实时查询资源占用情况

adb shell top 

查看CPU信息

adb shell dumpsys cpuifo 

查看内存信息

adb shell dumpsys meminfo 

查看电池信息

adb shell dumpsys battery 

执行Monkey测试,具体参数可通过adb shell monkey查看

adb shell monkey -p <package> <options>

应用包管理

查看应用列表

adb shell pm list packages 

清除应用缓存

adb shell pm clear <package> 

其他命令

进入Shell模式

adb shell  

截屏

adb shell screencap <options> <filename> 

录屏

adb shell screenrecord <options> <filename> 

查看手机IP地址

adb shell ifconfig 

参考资料

  • https://developer.android.google.cn/studio/command-line/adb

作者:酌三巡

感谢阅读,如需转载请注明出处!

原文地址:https://www.cnblogs.com/zhuosanxun/p/15016459.html