app怎么获取package与active name

1、aapt dump badging apk名称

2、adb logcat | grep START 或者 adb shell "logcat | grep START"

然后在模拟器中点击要获取package的app,查找cmp,cmp中前面是package name后面是activity name

START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.browser/.BrowserActivity bnds=[149,158][290,388] (has extras)} from pid 712

 3、adb shell dumpsys activity | grep "Run #"或者adb shell dumpsys activity | grep -i run

 


1、通过monkey 点击 某个app

adb shell monkey -p com.android.browser 10 点击次数10次

PS D:\Program Files\nox\Nox\bin> adb shell monkey -p com.android.browser 10
Events injected: 10
## Network stats: elapsed time=557ms (0ms mobile, 0ms wifi, 557ms not connected)

 

adb shell monkey -p com.android.browser --throttle 500 10 点击10次每次间隔500ms

PS D:\Program Files\nox\Nox\bin> adb shell monkey -p com.android.browser --throttle 500 10
Events injected: 10
## Network stats: elapsed time=648ms (0ms mobile, 0ms wifi, 648ms not connected)

 

 adb shell monkey  -p com.android.browser -s 123456 10 点击10次,同时保存一个执行的序列,

monkey 后面接 -s常用在复现问题,两次执行步骤一样


monkey 常用的参数

adb shell monkey -p packagename --throttle 500

--ignore-crashes  忽略app崩溃

--ignore-timeouts 忽略超时

--ignore-security-exceptions 忽略安全的异常

--ignore-native-crashes 忽略本地crash

--monitor-native-crashes 忽略全部的crash

-v -v -v 10000>c:\monkey_log 三个-v最高级别日志,然后重定向到文件中

adb shell monkey -p packagename --throttle 500 --ignore-crashes --ignore-timeouts --ignore-security-exceptions --ignore-native-crashes --monitor-native-crashes -v -v 10000>c:\monkey_log

 

-p package name

-v 日志等级

50 事件数

-- throttle 200 事件间隔时间200ms

--pct-touch 50 设置整个操作中所占的百分比

 

posted @ 2019-06-06 22:07  静心_心静  阅读(819)  评论(0编辑  收藏  举报