adb.bat文件
查看当前APP的包名和活动
adb shell dumpsys window | findstr mCurrentFocus
启动APP
adb shell am start com.tal.kaoyan/com.tal.kaoyan.ui.activity.SplashActivity
强制停止APP
adb shell am force-stop com.tal.kaoyan
清理缓存
adb shell pm clear com.tal.kaoyan
卸载APP
adb uninstall com.tal.kaoyan
进入安卓系统
底层是Linux系统,支持Linux命令 exit退出
adb shell
/data/app APP安装包不是应用商店下载的安装包,不能删除。
/data/data APP安装目录 APP性能相关占用内存
/sdcard存储卡目录 文件管理器
不进入Android系统直接执行命令
【场景】测试微信时,想测试给好友发送一张超过100M的图片,但测试的手机上没有这么大的图片文件,需要从电脑上发送给手机
adb push C:\Users\admin\Desktop\kaoyan.mp4 /sdcard/ 如果有中文需要加引号
adb pull /sdcard/adb.exe d:\tools\a.exe
adb install D:\tools\kaoyan3.1.0.apk
adb shell sleep 5
::启动首页
adb shell am start -n com.tal.kaoyan/.ui.activity.SplashActivity
adb shell sleep 5
::点击‘取消’ 根据坐标点击APP相应位置
adb shell input tap 460 710
adb shell sleep 1
::点击‘跳过’
adb shell input tap 650 53
adb shell sleep 1
::点击‘用户名’
adb shell input tap 158 287
adb shell sleep 1
adb shell input text yang10879897
adb shell sleep 1
::点击‘密码’
adb shell input tap 137 353
adb shell sleep 1
adb shell input text yang168168
adb shell sleep 1
::点击‘登录’按钮
adb shell input tap 358 484
adb shell sleep 5
:: 截屏并保存
adb shell screencap -p /sdcard/sc.png
adb pull /sdcard/sc.png d:\tools\sc.png
:: 停止APP
adb shell am force-stop com.tal.kaoyan
adb shell sleep 1
:: 清理缓存
adb shell pm clear com.tal.kaoyan
adb shell sleep 5
:: 卸载APP
adb uninstall com.tal.kaoyan
logcat的常用用法 logcat重定向(把日志信息保存在一个文件中,把文件存到电脑上)
格式:adb logcat > d:\111\log.txt
步骤:1)执行logcat重定向命令
2)在我们的设备上操作app
3)ctrl c结束抓取日志
4)在电脑上的指定位置查看日志文件
adb logcat > D:\111\log.txt 输出所有等级的日志
adb logcat *:W > d:\111\log.txt 只输出等级大于等于W的日志
adb logcat | find “not found” > d:\111\log.txt 按照关键字进行过滤
常用关键字 exception(APP程序异常)
crash(APP程序崩溃)
anr(APP程序无响应或卡死)