adb 命令

上一篇 / 下一篇  2019-12-13 15:55:12 / 个人分类:adb

一般日志:(先输入命令,再重现问题)
adb logcat -v time >
自己的保存的路径+要保存的文件名字
adb shell logcat >D:\SDK\log.txt
注意路径中的空格,命令输入完后一定要重现问题。

 

 

adb devices 查看链接模拟器

 

adb version 查看版本号

 adb connect 127.0.0.1:21503 链接模拟器

   127.0.0.1:62025 第二个

127.0.0.1:62026第三个

 

adb  shell进入设备底层命令  Linux 

 

 adb  -s指定设备号shell 进入该设备的底层命令

 

 # exit 退出底层命令

 

adb install 文件路径 

adb install -r文件路径  覆盖安装

adb -s 127.0.0.1:62025 install指定模拟器安装

 

查看包名1adb shell

          2cd  /data/app/

          3ls

          4、查看对应的包名。

          5exit

 卸载app

   adb uninstall 包名

 

adb kill -server 关闭adb服务

adb start -server开启adb服务

 

如果5037端口被占用

1、netstat -ano | findstr5037

2、taskkill -f -pid xxx

 

获取app Activity 

aapt dump badging文件路径

 

aapt dump badging包名  | findstrlaunchable activity 筛选出

 

monkey 参数

 

常规参数

1、帮助类参数  adb shell  monkey  -h

2、日志级别  0级:adb shell monkey -v 200(常用)

             1adb shell monkey -v -v 200(常用)

             2adb shell monkey -v -v -v 200

事件类参数

1、执行指定的脚本

adb shell monkey -f脚本名称

 

2、伪随机数生成种子值

  adb shell monkey -s伪随机数 执行数  (伪随机数随意设,可以加打印日志)

  

3、设置间隔 (--throttle

       adb shell monkey –throttle 间隔几秒(单位毫秒) 执行次数  (可加打印日志参数)

 

4、调试触摸事件百分比 (--pct-touch

       adb shell monkey --pct-touch 百分比 执行数  (可加打印日志参数)

 

5、调整手势事件百分比(--pct-motion

adb shell monkey -- pct -motion 百分比 执行数  (可加打印日志参数)

 

 6、调整应用启动事件的百分比(--pct-appswitch

  adb shell monkey -- pct - appswitch百分比 执行数  (可加打印日志参数)

 

7、调整屏幕旋转事件百分比(--pct-rotation

 adb shell monkey -- pct - rotation百分比 执行数  (可加打印日志参数)

 

事件百分比 命令

1

--pct-touch

触摸事件百分比

 

2

--pct-motion

动作事件百分比

 

3

--pct-trackball

轨迹球事件百分比

 

4

--pct-nav

基本导航事件百分比

 

5

--pct-majornav

主要导航事件百分比

 

6

--pct-syskeys

系统按键事件百分比

 

7

--pct-appswitch

应用启动事件百分比

 

8

--pct-anyevent

其他类型事件百分比

keypress

9

 

 

不常用的button

10

 

 

其他未提及事件

 

 

指定包monkey测试

 

adb shell monkey -p包名 执行数{可加一系列参数(-v日志  -s伪随机数–pct-xxxx 事件百分比)}
 
例如:adb shell monkey -v -s 999 –pct-touch 50 -p包名 执行数

可执行多个包进行monkey测试

  例如:adb shell monkey -p包名-p包名 执行数

 

activity类约束(一般不用,都是默认)

 例如:adb shell monkey -c Inten CATEGORY_LAUNCHER 执行数

调试类参数

1、应用崩溃后继续发送事件(--ignore-crashes)

  adb shell money  --ignore-crashes 

 发生崩溃后继续执行

2、超时错误继续发送事件(--ignore-timeouts

  adb shell monkey  --ignore-timeouts

 发生超时后继续执行

3、应用程序权限错误发生后继续发生事件(--ignore-security-exceptions

  Adb shell monkey  --ignore-security-exceptions

 继续执行

Monkey调用测试命令

--dbg-on-events

监视应用程序所调用的包之间的转换

--hprof

在事件序列前后立即生成profiling report

--ignore-crashes 出错继续事件

应用崩溃后继续发送事件

--ignore-timeouts 出错继续事件

超时错误继续发送事件

--ignore-security-exceptions出错继续事件

应用程序权限错误发生后继续发生事件

--kill-process-after-error

在应用程序出错后通知系统停止发生错误的进程

--monitor-native-crashes

监视并报告monkey运行时Android系统native code的崩溃事件

--wait-dbg

暂停执行中的monkey,直到有调试器与它连接


TAG:

 

评分:0

我来说两句

我的栏目

日历

« 2023-04-16  
      1
2345678
9101112131415
16171819202122
23242526272829
30      

数据统计

  • 访问量: 557
  • 日志数: 2
  • 建立时间: 2018-01-22
  • 更新时间: 2019-12-13

RSS订阅

Open Toolbar