Monkey测试:
adb shell
monkey -p com.lanto.water 10000 回车
- 1 将已经编写好的代码部署到模拟器/真机
- 2 打开CMD命令,输入命令 adb shell 切换到模拟器目录
- 3 输入 monkey -p 应用程序包名 测试次数 然后回车即可 monkey -p com.lanto.water 10000 回车
- 4 测试过程中,可以按电脑键盘上的Ctrl +C 终止测试
adb 查看当前展示的Activity
adb shell dumpsys activity | grep "mResumed"
//单设备
adb shell
dumpsys activity | grep "mResumed"
//多设备
//我的华为P40.
adb -s VEG5T20324000109 shell
dumpsys activity | grep "mResumed"
adb 查看APP的包名
连接打开前台app
adb shell "dumpsys window | grep mCurrentFocus"
adb wifi调试
连接adb connect
ip
adb connect
断开adb disconnect
ip
adb disconnect
查询当前设备所有安装应用包名
adb shell pm list packages
卸载apk
adb uninstall 应用包名
adb uninstall com.lanto.water
//VOG-AL10
adb -s APH0219909019978 uninstall com.lanto.water
启动APP
第1步:
adb shell dumpsys window windows | findstr "Current"
第2步:
adb shell am start -n 应用包名/启动页完整包名
adb shell dumpsys window windows | findstr "Current"
adb shell am start -n com.liantuo.xiaojingling.newsi/com.liantuo.xiaojingling.newsi.view.activity.SplashActivity
多设备情况下安装apk
adb -s CLB7N19212003136 install D:\ZxnWork\gitee\XiaoJingLing\apk\1.13.apk
adb -s da4dd095 install D:\ZxnWork\gitee\XiaoJingLing\apk\1.13.apk
列出当前设备
adb devices
D:\ZxnWork\gitee\xjl_mzks>adb devices
List of devices attached
CLB7N19212003136 device
da4dd095 device
连接单个手机安装apk
adb install -r xxxx.apk
注意:应用名称xxxx不能有中文
例如:安装医库app
`adb install -r D:\apks\com.medicool.zhenlipai.apk`
指定设备安装apk
//在emulator-5554模拟器上安装ebook.apk:
adb -s emulator-5554 install ebook.apk
//在真机上安装ebook.apk:
adb -s HT9BYL904399 install xx.apk
adb -s CLB7N19212003136 install D:\ZxnWork\gitee\xjl_mzks\app\build\outputs\apk\release\app-release.apk
显示系统中全部Android平台:
**android list targets**
终止adb服务进程:
adb kill-server
重启adb服务进程:
adb start-server