android-sdk工具下载地址:https://www.androiddevtools.cn/
adb命令参考:https://adbshell.com/commands
adb设备连接参考:https://developer.android.google.cn/studio/command-line/adb
adb devices
:查看设备连接列表
adb kill-server
:停止服务
adb start-server
:开启服务
adb logcat
:查看android应用运行日志
adb logcat | grep Displayed // (windows 将grep 改为 findstr)获取应用程序包名及启动入口
adb shell
:本身是一个linux的shell,可以调用android内置命令
adb shell monkey -p com.xueqiu.android 200 //指定APP执行 200 个随机事件
adb shell monkey -p com.xueqiu.android -throttle 1000 -v 200 //指定一秒钟执行一个事件,共执行200个(-throttle 指定执行时间)
adb shell am start -n com.xueqiu.android/.view.WelcomeActivityAlias -S //强行停止后,启动app应用
adb shell dumpsys activity top //获取当前运行的activity
adb shell pm clear apk包名 // 清除应用缓存
adb shell ps
adb shell monkey
adb shell uiautomator dump //获取当前界面元素内容保存在生成的.xml文件中
adb shell input tap 577 1123 // 模拟一次点击坐标x,y(577,1123)事件
adb pull remote
local
:从设备(远程)中复制某个文件或目录(及其子目录)到本地
adb push local
remote
:将本地某个文件或目录(及其子目录)复制到设备(远程)
adb kill-server
:关闭adb的后台进程
adb tcpip
:让android脱离usb连线的tcp连接方式
adb connect
:连接开启了tcp连接方式的手机
android 命令
android sdk // 显示 Android SDK manager 窗口
android avd // Displays the AVD Manager window.
android list avd //列出已创建的android虚拟设备
emulator 命令
emulator -list-avds //列出可用设备
emulator @设备名 //启动虚拟模拟器