1.adb devices 获取设备列表和状态
2.adb get–state 获取状态
devices:正常连接 offline:设备异常无响应 unknown:没有设备连接
3.adb get–serialno 获取设备序列号
4.adb kill–server—-结束adb服务
adb start–server—-启动adb 服务
5.adb logcat—-打印安卓系统日志
adb logcat >E:logcat.txt
6.adb bugreport—-打印dumpsys、dumpstate、logcat的输出,分析错误到文本
adb bugreport >e:bugreport.txt
7.adb install -r –g 安装apk 获取权限
多个设备需要指定:adb –s {设备序列号} install apk
覆盖安装:adb install -r apk
查看apk的名称:adb shell pm list packages
将文件移动到另一个路径:adb shell mv /sdcard/camera.apk /sdcard/Download/
复制文件到另一个路径:adb shell cp /sdcard/camera.apk /sdcard/Download/
8.adb uninstall—卸载应用,加包名;
9.adb pull—-将设备内容复制到本地
adb push—本地复制到手机
10.adb connect—–加上IP,远程连接产品
adb logcat –v time *:E 打印时间和级别简单数据
adb logcat *:e—-打印为error的信息
adb logcat –v time *:E >e:123.txt
11.获取权限
adb root
adb disable-verite
adb reboot
adb boot
adb remount
12.adb shell 进入dos页面
monkey 100 100个伪随机事件
运行24小时 每100秒发送一个事件 246060*1000/100=864000次
monkey –p ***
13.模拟屏幕点击事件: adb shell input tap 500 1450
模拟手势滑动事件:adb shell input swipe 500 2000 500 1500 100
模拟长按操作:adb shell input swipe 100 500 100 500 500
模拟键盘事件:adb shell input keyevent 25
模拟键盘长按事件:adb shell input keyevent —longpress 25
查看电池信息: adb shell dumpsys battery
设置电量信息: adb shell dumpsys battery set level 100
复位,恢复实际状态:adb shell dumpsys battery reset
查看activity信息:adb shell dumpsys activity
屏幕截图:
adb shell screencap –p /sdcard/screen.png
adb shell /system/bin/screencap –p /sdcard/xx.png 截频并保存文件在手机上为xx.Png
adb pull /sdcard/xx.png D:/xx.png 将手机xx.png文件保存到D盘文件下
录制屏幕:adb shell screenrecord —time-limit 15 /sdcard/record.mp4
查看设备CPU:adb shell dumpsys cpuinfo
查看设备进程:adb shell ps
查看实时资源占用:adb shell top
查看屏幕分辨率:adb shell wm size
查看屏幕密度:adb shell wm density
adb devices #查看连接设备
adb -s cf27456f shell # 指定连接设备使用命令
adb install test.apk # 安装应用
adb shell am start -n packagename/packagename.activity 启动应用
adb shell am force–stoppackagename.activity 强制停止运行程序
adb install -r demo.apk #安装apk 到sd 卡:
adb uninstall cn.com.test.mobile #卸载应用,需要指定包
adb uninstall -k cn.com.test.mobile #卸载app 但保留数据和缓存文件
adb shell pm list packages #列出手机装的所有app 的包名
adb shell p m list packages -3 #列出除了系统应用的第三方应用包名
adb shell pm clear cn.com.test.mobile #清除应用数据与缓存
adb shell am start –ncn.com.test.mobile/.ui.SplashActivity #启动应用
adb shell dumpsys package #包信息Package Information
adb shell dumpsys meminfo #内存使用情况Memory Usage
adb shell am force–stop cn.com.test.mobile #强制停止应用
adb logcat #查看日志
adb logcat –c #清除log 缓存
adb reboot #重启
adb get-serialno #获取序列号
adb shell getprop ro.build.version.release #查看Android 系统版本
adb shell top -s 10 #查看占用内存前10 的app
adb push <local> <remote> #从本地复制文件到设备
adb pull <remote> <local> #从设备复制文件到本地
adb bugreport #查看bug 报告
adb help #查看ADB 帮助
批处理说明:
1.txt文档保存格式一定是”ANSI”编码模式,否则汉字无法展示;
4.@ping 127.0.0.1 -n 3 >nul ———3代表的是延时时间
5.延时2
echo wscript.sleep 5000>sleep.vbs —5000代表5秒
start /wait sleep.vbs—启动
adb devices—指令
del /f /s /q sleep.vbs —–删除vbs文件