一、日志截取:
(1)adb shell monkey -p com.sina.weibo --ignore-crashes --ignore-timeouts --monitor-native-crashes -v -v 10000 > E:\xxx.log 运行时忽略崩溃、应用响应超时、监视系统中本地代码发生的崩溃,日志级别2个V模拟点击10000次,将日志信息打印出来并保存到系统E盘。名字为xxx.log。
(2)adb shell monkey -p com.njzx.weather --ignore-timeouts -v 1000 >E:\log.log
(3)adb shell monkey -p com.njzx.weather --ignore-timeouts --ignore-crashes -v -v 5000 >E:\log1.log
(4)adb shell monkey -p com.njzx.weather --ignore-timeouts --ignore-crashes --monitor-native-crashes -v -v -v 6000 >E:\log2.log
二、日志分析
1、Event percentages分配事件的百分比
// 0: 15.0% 触摸事件百分比,即参数--pct-touch
// 1: 10.0% 手势事件百分比,即参数--pct-motion
// 2: 2.0% 缩放事件百分比,即参数--pct-pinchzoom
// 3: 15.0% 轨迹球事件百分比,即参数--pct-trackball
// 4: -0.0% 屏幕旋转事件百分比,即参数--pct-rotation
// 5: -0.0% 基本导航事件百分比,即参数--pct-nav
// 6: 25.0% 主要导航事件百分比,即参数--pct-majornav
// 7: 15.0% 系统事件百分比,即参数--pct-syskeys
// 8: 2.0% Activity启动事件百分比,即参数--pct-appswitch
// 9: 2.0% 键盘翻转事件百分比,即参数--pct-flip
// 10: 1.0% 其他事件百分比,即参数--pct-anyevent
// 11: 13.0%
2、crash:
程序崩溃(CRASH)和程序无响应(ANR)
截取日志中的crash后面为此次崩溃信息日志(以下为日志)
最后标红的区域可以通过seed完成崩溃复现<如下>。
adb shell monkey -p com.njzx.weather -s 1517547958295 -v -v -v 6000 > E:\logx.log
*******************************************************************************************************************
*******************************************************************************************************************
//CRASH: com.njzx.weather (pid 18021)
// Short Msg: java.lang.IndexOutOfBoundsException
// Long Msg: java.lang.IndexOutOfBoundsException: Index: 1, Size: 2
// Build Label: ZTEtech/full_bd6737t_36g_c_n/bd6737t_36g_c_n:7.0/NRD90M/1510750319:user/
// Build Changelist: 1510750319
// Build Time: 1510750284000
// java.lang.IndexOutOfBoundsException: Index: 1, Size: 2
//at java.util.ArrayList.get(ArrayList.java:411)
//at com.njzx.weather.fragment.CityWeatherFragment$1.handleMessage(CityWeatherFragment.java:88)
//at android.os.Handler.dispatchMessage(Handler.java:110)
//at android.os.Looper.loop(Looper.java:203)
//at android.app.ActivityThread.main(ActivityThread.java:6251)
//at java.lang.reflect.Method.invoke(Native Method)
//at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
//at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
//
** Monkey aborted due to error.
Events injected: 5721
:Sending rotation degree=0, persist=false
:Dropped: keys=4 pointers=0 trackballs=0 flips=0 rotations=0
## Network stats: elapsed time=29941ms (0ms mobile, 0ms wifi, 29941ms not connected)
**System appears to have crashed at event 5721 of 6000 using seed 1517547958295
*******************************************************************************************************************
*******************************************************************************************************************