Monkey稳定性测试

1 Monkey测试简介

   Monkey是SDK中自带的工具,在sdk的tools文件夹下,连接Android设备时,命令行里输入相应命令就能运行;
   用户可以模拟Application切换、横竖屏、应用关闭等等,但Monkey对应用的操作是随机的,如果需要指定操作,可以在项目中引入UI自动化,
如Robotium、Appium等;
   Monkey测试结果里不能有nullPointException和Crash出现,开发人员结合monkey打印的日志和系统打印的日志,解决测试中出现的问题。

2 Monkey 测试命令
2.1 命令参数

adb shell monkey [options]

usage: monkey [-p ALLOWED_PACKAGE [-p ALLOWED_PACKAGE] ...]
              [-c MAIN_CATEGORY [-c MAIN_CATEGORY] ...]
              [--ignore-crashes] [--ignore-timeouts]
              [--ignore-security-exceptions]
              [--monitor-native-crashes] [--ignore-native-crashes]
              [--kill-process-after-error] [--hprof]
              [--pct-touch PERCENT] [--pct-motion PERCENT]
              [--pct-trackball PERCENT] [--pct-syskeys PERCENT]
              [--pct-nav PERCENT] [--pct-majornav PERCENT]
              [--pct-appswitch PERCENT] [--pct-flip PERCENT]
              [--pct-anyevent PERCENT] [--pct-pinchzoom PERCENT]
              [--pct-permission PERCENT]
              [--pkg-blacklist-file PACKAGE_BLACKLIST_FILE]
              [--pkg-whitelist-file PACKAGE_WHITELIST_FILE]
              [--wait-dbg] [--dbg-no-events]
              [--setup scriptfile] [-f scriptfile [-f scriptfile] ...]
              [--port port]
              [-s SEED] [-v [-v] ...]
              [--throttle MILLISEC] [--randomize-throttle]
              [--profile-wait MILLISEC]
              [--device-sleep-time MILLISEC]
              [--randomize-script]
              [--script-log]
              [--bugreport]
              [--periodic-bugreport]
              [--permission-target-system]
              COUNT

2.2 参数详解

-p:指定有效的package(如不指定,则对系统中所有package有效),一个-p 对应一个有效package, 

-p com.moco.mcplayer -p com.moco.mcplayer.alpha

       
-c:activity必须至少包含一个指定的category  (Intent.CATEGORY_LAUNCHER 或Intent.CATEGORY_MONKEY ),才能被启动,否则启动不了。( 这里指直接被monkey程序调起,界面中被点击事件启动的不包括在内)

-c  android.intent.category.CATEGORY_MONKEY


--ignore-crashes :  忽略崩溃(不中断测试,之后可以在日志中查询信息)

--ignore-timeouts: 忽略超时ANR (不中断测试)

--ignore-security-exceptions: 忽略安全异常(不中断测试)

--monitor-native-crashes: 跟踪native方法的崩溃问题

--ignore-native-crashes: 忽略native崩溃 (不中断测试)

--kill-process-after-error:发生错误后直接杀掉进程

--hprof: 开始测试前和测试结束后生成trace 报告,会在/data/misc 目录下产生大文件

--pct-touch: 触摸事件,占总事件的百分比

--pct-motion: 滑动事件百分比

--pct-trackball:  轨迹球事件百分比
--pct-syskeys: 系统按键事件百分比 (Home 、Back 、startCall 、 endCall 、 volumeControl)

--pct-nav: 导航事件百分比(上,下,左,右)

--pct-majornav: 主要导航事件百分比( back key 、 menu key)

--pct-appswitch:  Activity切换事件百分比

--pct-flip: 键盘翻转事件百分比

--pct-anyevent: 其他任意事件百分比 (其他不常用设备按钮按键等)

--pct-pinchzoom: 缩放事件百分比

--pct-permission:

--pkg-blacklist-file:  指定不执行monkey的包名列表文件

--pkg-whitelist-file: 指定执行monkey的包名列表文件

--wait-dbg:   应用调试器 debugger attach 之前 monkey 不会开始发送事件

--dbg-no-events: 初始化启动的activity,但是不产生任何事件

-s: 产生随机数的种子,使用同一个seed, monkey 会确保生成相同的事件

-v: 日志级别,默认为0,增加 -v 的个数可以增加日志级别,输出更详细日志(最多3个 -v -v -v)

--throttle: 事件之间的间隔,不设置时,在android系统极限内操作,若手机性能较低,容易出现系统无响应,最佳的时间间隔在300或者500(毫秒)

--randomize-throttle: 设置随机时间的事件间隔

--device-sleep-time: 设备休眠时间

--bugreport: 设置Monkey运行时自动记录发生crash,anr,system not responding的错误信息

2.3 命令实例

adb shell monkey -p com.moco.mcplayer -v 400000 -throttle 10 --pct-touch 30 -–pct-motion 20 -–pct-nav 20 -–pct-majornav 15 -–pct-appswitch 5 -–pct-anyevent 5 -–pct-trackball 5 -–pct-syskeys 0 '%s' --ignore-crashes --ignore-timeouts --ignore-security-exceptions > E:\monkey_log\monkey_log.txt

2.4 命令解释

-p com.moco.mcplayer

执行程序包名为 com.moco.mcplayer

—ignore-crashes

忽略崩溃问题,遇到问题继续执行monkey测试

—ignore-timeouts

忽略anr问题,遇到问题继续执行monkey测试

—ignore-security-exceptions

忽略安全问题,遇到问题继续执行monkey测试

—pct-trackball 0

轨迹球事件 0%

—pct-nav 0

导航事件 0%

—pct-majornav 0

主要导航事件 0%

—pct-anyevent 0

其他不常用任意事件 0%

-v -v -v

日志级别最高,记录所有信息

—throttle 500

事件之间间隔 500 毫秒

1200000000

总共发送1200000000个事件(一次500毫秒,1200000000 需要约 6944 天)

> E:\monkey_log\monkey_log.txt

monkey 执行日志保存至 E盘 monkey_log 文件夹 monkey_log.txt 文件

3.日志分析
3.1 日志示例

:Monkey: seed=1467305921677 count=120000000
:AllowPackage: com.moco.tcl
:IncludeCategory: android.intent.category.LAUNCHER
:IncludeCategory: android.intent.category.MONKEY
// Selecting main activities from category android.intent.category.LAUNCHER
//   - NOT USING main activity com.android.camera.CameraLauncher (from package com.tct.camera3)
//   - NOT USING main activity com.android.settings.SettingsTab (from package com.android.settings)
//   - NOT USING main activity com.android.deskclock.DeskClock (from package com.android.deskclock)
//   - NOT USING main activity com.android.contacts.activities.PeopleActivity (from package com.android.contacts)
//   - NOT USING main activity com.android.dialer.DialtactsActivity (from package com.android.contacts)
//   + Using main activity com.moco.tcl.CSplashScreen (from package com.moco.tcl)
// Selecting main activities from category android.intent.category.MONKEY
// Seeded: 1467305921677
// Event percentages:
//   0: 46.875%
//   1: 31.25%
//   2: 6.25%
//   3: -0.0%
//   4: -0.0%
//   5: -0.0%
//   6: -0.0%
//   7: -0.0%
//   8: 6.25%
//   9: 6.25%
//   10: 3.125%
//   11: -0.0%
:Switch: #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.moco.tcl/.CSplashScreen;end
    // Allowing start of Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.moco.tcl/.CSplashScreen } in package com.moco.tcl
Sleeping for 500 milliseconds
:Sending Touch (ACTION_DOWN): 0:(22.0,1036.0)
:Sending Touch (ACTION_UP): 0:(33.727005,1025.7482)
Sleeping for 500 milliseconds
:Sending Touch (ACTION_DOWN): 0:(840.0,1031.0)
:Sending Touch (ACTION_UP): 0:(823.241,1017.319)
Sleeping for 500 milliseconds
:Sending Touch (ACTION_DOWN): 0:(429.0,1721.0)
:Sending Touch (ACTION_UP): 0:(432.43265,1730.7511)
Sleeping for 500 milliseconds
:Sending Touch (ACTION_DOWN): 0:(917.0,956.0)

:Sending Touch (ACTION_UP): 0:(919.1181,955.37024)
Sleeping for 500 milliseconds
:Sending Touch (ACTION_DOWN): 0:(393.0,537.0)
:Sending Touch (ACTION_UP): 0:(392.4326,534.28046)
Sleeping for 500 milliseconds
:Sending Touch (ACTION_DOWN): 0:(975.0,1496.0)
:Sending Touch (ACTION_UP): 0:(977.1913,1503.4038)
Sleeping for 500 milliseconds

3.2 日志解析

:Monkey: seed=1467305921677 count=120000000
monkey执行的seed值和随机事件次数

:AllowPackage: com.moco.tcl
可以运行的包名

// Event percentages:
//   0: 46.875%
//   1: 31.25%
//   2: 6.25%
//   3: -0.0%
//   4: -0.0%
//   5: -0.0%
//   6: -0.0%
//   7: -0.0%
//   8: 6.25%
//   9: 6.25%
//   10: 3.125%
//   11: -0.0%

分配事件的百分比
0:触摸事件百分比,即参数–pct-touch
1:滑动事件百分比,即参数–pct-motion
2:缩放事件百分比,即参数–pct-pinchzoom
3:轨迹球事件百分比,即参数–pct-trackball
4:屏幕旋转事件百分比,即参数–pct-rotation

5:基本导航事件百分比,即参数–pct-nav
6:主要导航事件百分比,即参数–pct-majornav
7:系统事件百分比,即参数–pct-syskeys
8:Activity启动事件百分比,即参数–pct-appswitch
9:键盘翻转事件百分比,即参数–pct-flip
10:其他事件百分比,即参数–pct-anyevent

事件0:触摸事件

Sending Touch (ACTION_DOWN): 0:(572.0,1105.0)
Sending Touch (ACTION_UP): 0:(576.20734,1105.024)

事件1:滑动事件

  Sending Touch (ACTION_DOWN): 0:(233.0,761.0)
  Sending Touch (ACTION_MOVE): 0:(208.49568,736.34766)
  Sending Touch (ACTION_MOVE): 0:(202.7063,729.8338)
  Sending Touch (ACTION_MOVE): 0:(183.89723,722.677)
  Sending Touch (ACTION_UP): 0:(174.83568,721.8229)

事件2:缩放事件

  Sending Touch (ACTION_DOWN): 0:(107.0,242.0)
  Sending Touch (ACTION_POINTER_DOWN 1): 0:(108.14705,248.53061) 1:(270.0,262.0)
  Sending Touch (ACTION_MOVE): 0:(110.117355,252.96329) 1:(267.9937,262.25485)
  Sending Touch (ACTION_MOVE): 0:(111.30056,261.88846) 1:(261.90106,262.58475)
  Sending Touch (ACTION_MOVE): 0:(113.11743,265.60138) 1:(253.92662,263.13382)
  Sending Touch (ACTION_POINTER_UP 1): 0:(113.29031,267.4419) 1:(248.60628,263.23257)

事件3:轨迹球事件

  Sending Trackball (ACTION_MOVE): 0:(3.0,-2.0)
  Sending Trackball (ACTION_MOVE): 0:(1.0,-1.0)

事件4:屏幕旋转事件(隐藏事件)

Sending rotation degree=0,persist=true

事件5:导航事件(上下左右)

Sending Key (ACTION_DOWN): 21    // KEYCODE_DPAD_LEF

事件6:主要导航事件(menu等)

 Sending Key (ACTION_DOWN): 23    // KEYCODE_DPAD_CENTER

事件7:系统按键事件(音量,home,返回按键等)

Sending Key (ACTION_UP): 25    // KEYCODE_VOLUME_DOWN

事件8:启动应用事件

 :Switch: #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.moco.tcl/.CSplashScreen;end

事件9:键盘事件(隐藏显示键盘)

Sending Flip keyboardOpen=true

事件10:其他按键

 Sending Key (ACTION_DOWN): 66    // KEYCODE_ENTER
 Sending Key (ACTION_UP): 66    // KEYCODE_ENTER

延时

Sleeping for 500 milliseconds

3.3异常分析
ANR 问题,Monkey 日志中会打印出详细的ANR Trace,可以通过ANR Trace分析具体问题

:Sending Touch (ACTION_DOWN): 0:(98.0,315.0) 
// NOT RESPONDING: com.moco.mcplayer (pid 1014) 
ANR in com.moco.mcplayer (com.moco.mcplayer/.CSplashScreen) 
Reason: keyDispatchingTimedOut 
Load: 4.55 / 4.38 / 3.69 
CPU usage from 4481ms to -1188ms ago: 
  17% 332/system_server: 12% user + 5.4% kernel / faults: 1240 minor 7 major 
  2.3% 134/surfaceflinger: 1.5% user + 0.7% kernel 
  1.9% 1014/com.moco.mcplayer: 0.7% user + 1.2% kernel / faults: 393 minor 3 major 
  1.4% 2699/com.moco.mcplayer:Picture: 1.4% user + 0% kernel 
  1% 2477/com.wandoujia.player.walkman: 0.7% user + 0.3% kernel / faults: 328 minor 2 major 
  0.7% 2144/kworker/0:2: 0% user + 0.7% kernel 
  0.7% 2511/kworker/1:2: 0% user + 0.7% kernel 

  0.5% 72/irq/379-lis3dh: 0% user + 0.5% kernel 
  0.3% 450/com.android.systemui: 0.3% user + 0% kernel / faults: 100 minor 
  0% 1886/com.tencent.mm:push: 0% user + 0% kernel / faults: 526 minor 2 major 
  0.1% 83/mmcqd/0: 0% user + 0.1% kernel 
  0.1% 481/dhd_dpc: 0% user + 0.1% kernel 
  0% 518/wpa_supplicant: 0% user + 0% kernel 
  0% 554/com.lbe.security.miui: 0% user + 0% kernel / faults: 185 minor 
  0% 569/com.xiaomi.xmsf: 0% user + 0% kernel / faults: 333 minor 3 major 
  0% 587/com.duokan.airkan.phone: 0% user + 0% kernel / faults: 182 minor 
  0% 776/com.tencent.mobileqq:MSF: 0% user + 0% kernel / faults: 4 minor 
  0.1% 2597/kworker/u:1: 0% user + 0.1% kernel 
  0.1% 2659/kworker/u:3: 0% user + 0.1% kernel 
  0% 18774/com.sina.weibo: 0% user + 0% kernel / faults: 6 minor 
  18% TOTAL: 9.1% user + 4.4% kernel + 4.8% iowait + 0% softirq 
  CPU usage from 596ms to 1117ms later with 99% awake: 
  9.4% 332/system_server: 5.6% user + 3.7% kernel / faults: 42 minor 
  5.6% 403/InputDispatcher: 3.7% user + 1.8% kernel 
  3.7% 338/Compiler: 3.7% user + 0% kernel 
  1.8% 402/er$SensorThread: 0% user + 1.8% kernel 
  6.4% 1014/com.moco.mcplayer: 1.2% user + 5.1% kernel / faults: 185 minor 
  6.4% 1258/AsyncTask #2: 2.5% user + 3.8% kernel 
  1.2% 518/wpa_supplicant: 0% user + 1.2% kernel 
  1.3% 2477/com.wandoujia.player.walkman: 1.3% user + 0% kernel 
  1.3% 2511/kworker/1:2: 0% user + 1.3% kernel 
  11% TOTAL: 4.8% user + 6.7% kernel 

procrank: 
  PID Vss Rss Pss Uss cmdline 
 1014 177420K 172008K 86485K 43464K com.moco.mcplayer 
 2699 100016K 99544K 58213K 54608K com.moco.mcplayer:Picture 
 3408 125964K 120620K 49817K 9688K com.moco.mcplayer 
 31167 76560K 76220K 41223K 36704K com.moco.mcplayer 
 450 74516K 70188K 34378K 32332K com.android.systemui 
 332 66160K 65556K 30428K 28492K system_server 
 597 60840K 60708K 25572K 24020K com.miui.home 
 893 59216K 59136K 23628K 18808K com.wandoujia.phoenix2 
 1905 55396K 55300K 23217K 20772K com.tencent.mm 
 2936 61992K 61880K 21637K 18444K com.moco.mcplayer:pictureShow 
 21282 53380K 53204K 20787K 18472K com.tencent.mobileqq 
 709 54480K 54420K 19631K 18040K com.android.settings

 2477 55944K 55880K 18983K 13872K com.wandoujia.player.walkman 
 3060 46808K 46668K 17198K 14796K com.moco.mcplayer 
 18774 51104K 51016K 16956K 13488K com.sina.weibo 
 1757 49840K 49720K 16300K 12908K com.sina.weibo:remote 
 776 46696K 46620K 13768K 11392K com.tencent.mobileqq:MSF 
 1886 43956K 43868K 12386K 10036K com.tencent.mm:push 
 21368 40408K 40264K 9799K 8868K android.process.acore 
 21399 40700K 40620K 9647K 8692K com.google.process.gapps 
 521 41356K 41276K 9603K 8560K com.android.inputmethod.latin 
 1848 41700K 41612K 9433K 8084K com.moco.mcplayer:pushservice 
 540 38476K 38400K 7420K 6436K com.android.phone 
 21311 37664K 37536K 7001K 6056K com.miui.cloudservice 
 569 37656K 37568K 6943K 6036K com.xiaomi.xmsf 
 2673 18100K 18056K 6882K 6172K com.android.commands.monkey 
 1489 37540K 37464K 6792K 5912K com.kingroot.kinguser:service 
 615 37832K 37708K 6381K 5292K com.lbe.security.miui:service 
 2785 37220K 37152K 6224K 5264K com.miui.player 
 134 28840K 11244K 6151K 5816K /system/bin/surfaceflinger 
 750 37504K 37368K 5962K 4872K com.xiaomi.market 
 2819 35816K 35676K 5376K 4304K com.android.mms 
  749 35044K 34956K 5216K 4356K com.baidu.map.location:remote 
  137 11128K 10956K 4699K 4184K /system/bin/mediaserver 
  790 34716K 34576K 4684K 3852K android.process.media 
  700 33596K 33448K 3734K 2768K com.android.calendar 
  133 3836K 3832K 3619K 3616K /system/bin/debuggerd 
  27079 33244K 33100K 3534K 2620K com.android.providers.calendar 
  724 32972K 32828K 3492K 2540K com.baidu.map.location 
  135 39644K 39480K 3416K 1284K zygote 
  554 32368K 32224K 3108K 2176K com.lbe.security.miui 
 1210 31956K 31808K 2965K 2112K com.qualcomm.wiper 
  587 31712K 31568K 2880K 1956K com.duokan.airkan.phone 
  651 31428K 31276K 2646K 1636K com.android.smspush 
  174 1856K 1856K 1250K 1204K /system/bin/rild 
  129 4252K 4252K 1119K 1032K /system/bin/servicemanager 
  143 4228K 4224K 1108K 1036K /system/bin/fmradioserver 
  136 4264K 4264K 1101K 1028K /system/bin/drmserver 
  261 4212K 4208K 1096K 1020K /system/xbin/shelld 
 3411 1308K 1300K 1091K 1088K procrank 
  132 1704K 1700K 877K 836K /system/bin/netd 
  847 1236K 1224K 789K 748K /system/bin/thermald
156 1248K 1236K 774K 732K /system/bin/time_daemon 
  518 1244K 1240K 596K 584K /system/bin/wpa_supplicant 
  179 824K 820K 530K 492K /system/bin/netmgrd 
  139 988K 988K 387K 316K /system/bin/installd 
  176 640K 636K 380K 372K /system/bin/qmuxd 
  130 996K 992K 376K 360K /system/bin/vold 
  145 716K 712K 329K 292K /system/bin/wiperiface 
  158 284K 284K 256K 256K /sbin/adbd 
15991 472K 468K 202K 196K /system/bin/dhcpcd 
    1 276K 276K 198K 156K /init 
 2671 392K 384K 190K 188K /system/bin/sh 
 1534 600K 592K 175K 168K k_worker/31:0 
 1732 600K 592K 175K 168K /system/xbin/ku.sud 
  141 560K 552K 170K 164K /system/bin/keystore 
  138 472K 464K 143K 132K /system/bin/dbus-daemon 
 1269 356K 348K 139K 136K uuids_sys 
   92 176K 176K 134K 92K /sbin/ueventd 
  183 120K 120K 120K 120K /system/xbin/ku.sud 
  148 336K 332K 119K 116K /system/bin/mm-pp-daemon 
  155 3416K 340K 115K 112K /system/bin/rmt_storage 
 2149 312K 304K 95K 92K /data/data/com.moco.mcplayer/files/gdaemon 
  516 288K 280K 78K 76K /system/bin/logwrapper 
                          ------ ------ ------ 
                         692365K 537112K TOTAL 

RAM: 815636K total, 11384K free, 132K buffers, 105608K cached, 1748K shmem, 16708K slab 
// procrank status was 0 
anr traces: 


----- pid 1014 at 2015-06-03 03:36:40 ----- 
Cmd line: com.moco.mcplayer 
DALVIK THREADS: 
(mutexes: tll=0 tsl=0 tscl=0 ghl=0) 
"main" prio=5 tid=1 NATIVE 
  | group="main" sCount=1 dsCount=0 obj=0x410aac40 self=0x145fb90 
  | sysTid=1014 nice=0 sched=0/0 cgrp=default handle=1074267384 
  | schedstat=( 0 0 0 ) utm=22926 stm=3906 core=1 
  at java.lang.ProcessManager.exec(Native Method)
at java.lang.ProcessManager.exec(ProcessManager.java:209) 
  at java.lang.Runtime.exec(Runtime.java:168) 
  at java.lang.Runtime.exec(Runtime.java:241) 
  at java.lang.Runtime.exec(Runtime.java:184) 
  at com.moco.mcplayer.util.ImmersiveStatusBar.a(ImmersiveStatusBar.java:87) 
  at com.moco.mcplayer.util.ImmersiveStatusBar.a(ImmersiveStatusBar.java:106) 
  at com.moco.mcplayer.CSplashScreen.initWindow(CSplashScreen.java:57) 
  at com.moco.mcplayer.activity.BaseFragmentActivity.onCreate(BaseFragmentActivity.java:44) 
  at com.moco.mcplayer.CSplashScreen.onCreate(CSplashScreen.java:46) 
  at android.app.Activity.performCreate(Activity.java:4471) 
  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 
  at com.alimama.mobile.sdk.lab.InstrumentationHook.callActivityOnCreate(InstrumentationHook.java:192) 
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1933) 
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1994) 
  at android.app.ActivityThread.access$600(ActivityThread.java:126) 
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1150) 
  at android.os.Handler.dispatchMessage(Handler.java:99) 
  at android.os.Looper.loop(Looper.java:137) 
  at android.app.ActivityThread.main(ActivityThread.java:4439) 
  at java.lang.reflect.Method.invokeNative(Native Method) 
  at java.lang.reflect.Method.invoke(Method.java:511) 
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787) 
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554) 
  at dalvik.system.NativeStart.main(Native Method) 

"Thread-14823" prio=5 tid=65 NATIVE 
  | group="main" sCount=1 dsCount=0 obj=0x442ab9a0 self=0x212eff8 
  | sysTid=3366 nice=0 sched=0/0 cgrp=default handle=30833304 
  | schedstat=( 0 0 0 ) utm=1 stm=0 core=1 
  at dalvik.system.NativeStart.run(Native Method) 

"Thread-14815" prio=4 tid=39 NATIVE 
  | group="main" sCount=1 dsCount=0 obj=0x42eb6e88 self=0x1d429b8

| sysTid=2637 nice=10 sched=0/0 cgrp=bg_non_interactive handle=23358224 
  | schedstat=( 0 0 0 ) utm=70 stm=106 core=0 
  at dalvik.system.NativeStart.run(Native Method) 

"AsyncTask #12" prio=5 tid=63 WAIT 
  | group="main" sCount=1 dsCount=0 obj=0x42154bc0 self=0x1c9d660 
  | sysTid=3322 nice=10 sched=0/0 cgrp=bg_non_interactive handle=31195352 
  | schedstat=( 0 0 0 ) utm=0 stm=3 core=0 
  at java.lang.Object.wait(Native Method) 
  - waiting on <0x42154d28> (a java.lang.VMThread) held by tid=63 (AsyncTask #12) 
  at java.lang.Thread.parkFor(Thread.java:1231) 
  at sun.misc.Unsafe.park(Unsafe.java:323) 
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157) 
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2022) 
  at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:413) 
  at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1009) 
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1069) 
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) 
  at java.lang.Thread.run(Thread.java:856) 

Crash问题,Monkey日志中会打印出详细的调用栈,可以分析出具体问题

Sending Key (ACTION_DOWN): 23 // KEYCODE_DPAD_CENTER 
// CRASH: com.moco.mcplayer (pid 18767) 
// Short Msg: java.lang.NullPointerException 
// Long Msg: java.lang.NullPointerException: Failure delivering result ResultInfo{who=null, request=328139, result=0, data=null} to activity {com.moco.mcplayer/com.moco.mcplayer.activity.main.MainActivity}: java.lang.NullPointerException 
// Build Label: Lenovo/A820t/A820t:4.1.2/JZO54K/A820t_S115.130328:user/release-keys 
// Build Changelist: A820t_S115.130328 
// Build Time: 1364474050000 
// java.lang.RuntimeException: Unable to resume activity {com.moco.mcplayer/com.moco.mcplayer.activity.main.MainActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=328139, result=0, data=null} to activity {com.moco.mcplayer/com.moco.mcplayer.activity.main.MainActivity}: java.lang.NullPointerException 
// at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2737) 
// at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2765) 
// at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2221) 
// at android.app.ActivityThread.access$600(ActivityThread.java:149) 
// at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1305) 
// at android.os.Handler.dispatchMessage(Handler.java:99) 
// at android.os.Looper.loop(Looper.java:153) 
// at android.app.ActivityThread.main(ActivityThread.java:5000) 
// at java.lang.reflect.Method.invokeNative(Native Method) 

// at java.lang.reflect.Method.invoke(Method.java:511) 
// at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821) 
// at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584) 
// at dalvik.system.NativeStart.main(Native Method) 
// Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=328139, result=0, data=null} to activity {com.moco.mcplayer/com.moco.mcplayer.activity.main.MainActivity}: java.lang.NullPointerException 
// at android.app.ActivityThread.deliverResults(ActivityThread.java:3308) 
// at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2720) 
// ... 12 more 
// Caused by: java.lang.NullPointerException 
// at com.moco.mcplayer.activity.main.MainActivity.onActivityResult(MainActivity.java:813) 
// at android.app.Activity.dispatchActivityResult(Activity.java:5204) 
// at android.app.ActivityThread.deliverResults(ActivityThread.java:3304) 
// ... 13 more 
// 
** Monkey aborted due to error. 
Events injected: 11016 
:Sending rotation degree=0, persist=false 
:Dropped: keys=11 pointers=1 trackballs=0 flips=0 rotations=0 

Network stats: elapsed time=63521ms (0ms mobile, 63521ms wifi, 0ms not connected)

** System appears to have crashed at event 11016 of 300000 using seed 0
Finished: SUCCESS

你可能感兴趣的:(android专项)