MonkeyRunner导致Android设置崩溃

时间:2016-07-01 21:24:24

标签: android crash monkeyrunner appsettings

我一直在尝试使用Android打开辅助功能服务。我使用Android Studio(Nexus S API 19,armabi-v7)运行模拟器。我可以在模拟器运行时打开辅助功能设置。 (点击带圆圈的子菜单) Setting Screen with Accessibility Sub-Menu highlighted

然而,当我跑步时,尝试通过打开一个交互式的monkeyrunner终端并运行来附加monkeyrunner:

>> from android.com.monkeyrunner import MonkeyRunner, MonkeyDevice
>> d = MonkeyRunner.waitForConnection()

我无法导航到辅助功能设置屏幕并收到错误消息

Result of selecting accessibility sub-menu from settings when MonkeyDevice is attached

一旦我分离了MonkeyDevice,我就可以再次进入辅助功能设置屏幕。知道是什么原因引起的吗?

如果出现错误,请从日志中获取

代码段

##Logs from Failure ## I/ActivityManager(  357): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.settings/.Settings} from pid 519 ... I/ActivityManager(  357): START u0 {act=android.intent.action.MAIN cmp=com.android.settings/.SubSettings (has extras)} from pid 751

...

D/SubSettings(  751): Launching fragment com.android.settings.accessibility.AccessibilitySettings ... E/AndroidRuntime(  751): FATAL EXCEPTION: main

E/AndroidRuntime(  751): Process: com.android.settings, PID: 751

E/AndroidRuntime(  751): java.lang.RuntimeException: Unable to resume activity {com.android.settings/com.android.settings.SubSettings}: java.lang.NullPointerException

E/AndroidRuntime(  751):    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2774)

E/AndroidRuntime(  751):    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2803)

E/AndroidRuntime(  751):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2238)

E/AndroidRuntime(  751):    at android.app.ActivityThread.access$800(ActivityThread.java:135)

E/AndroidRuntime(  751):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)

E/AndroidRuntime(  751):    at android.os.Handler.dispatchMessage(Handler.java:102)

E/AndroidRuntime(  751):    at android.os.Looper.loop(Looper.java:136)

E/AndroidRuntime(  751):    at android.app.ActivityThread.main(ActivityThread.java:5001)

E/AndroidRuntime(  751):    at java.lang.reflect.Method.invokeNative(Native Method)

E/AndroidRuntime(  751):    at java.lang.reflect.Method.invoke(Method.java:515)

E/AndroidRuntime(  751):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)

E/AndroidRuntime(  751):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)

E/AndroidRuntime(  751):    at dalvik.system.NativeStart.main(Native Method)

E/AndroidRuntime(  751): Caused by: java.lang.NullPointerException

E/AndroidRuntime(  751):    at com.android.settings.accessibility.AccessibilitySettings.loadInstalledServices(AccessibilitySettings.java:641)

E/AndroidRuntime(  751):    at com.android.settings.accessibility.AccessibilitySettings.onResume(AccessibilitySettings.java:214)

E/AndroidRuntime(  751):    at android.app.Fragment.performResume(Fragment.java:1743)

E/AndroidRuntime(  751):    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:924)

E/AndroidRuntime(  751):    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)

E/AndroidRuntime(  751):    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1044)

E/AndroidRuntime(  751):    at android.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:1863)

E/AndroidRuntime(  751):    at android.app.Activity.performResume(Activity.java:5320)

E/AndroidRuntime(  751):    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2764)

E/AndroidRuntime(  751):    ... 12 more

W/ActivityManager(  357):   Force finishing activity com.android.settings/.SubSettings

W/ActivityManager(  357):   Force finishing activity com.android.settings/.Settings ... W/ActivityManager(  357): Activity pause timeout for ActivityRecord{b3ea9e08 u0 com.android.settings/.SubSettings t2 f} 

似乎有一个NullPointer异常,但我不知道是什么原因造成的

##Log Snippet Without Failure I/ActivityManager(  357): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.settings/.Settings} from pid 519

I/ActivityManager(  357): Start proc com.android.settings for activity com.android.settings/.Settings: pid=1095 uid=1000 gids={41000, 1028, 1015, 3002, 3001, 3003}

D/dalvikvm(   59): GC_EXPLICIT freed 40K, 5% free 2777K/2900K, paused 15ms+3ms, total 96ms

D/dalvikvm(   59): GC_EXPLICIT freed <1K, 5% free 2777K/2900K, paused 3ms+14ms, total 67ms

D/dalvikvm(   59): GC_EXPLICIT freed <1K, 5% free 2777K/2900K, paused 7ms+14ms, total 76ms

D/dalvikvm( 1095): GC_FOR_ALLOC freed 118K, 7% free 2987K/3188K, paused 35ms, total 37ms

I/dalvikvm-heap( 1095): Grow heap (frag case) to 3.602MB for 635812-byte allocation

D/dalvikvm( 1095): GC_FOR_ALLOC freed 3K, 6% free 3605K/3812K, paused 44ms, total 44ms

D/dalvikvm( 1095): GC_CONCURRENT freed <1K, 6% free 3605K/3812K, paused 4ms+2ms, total 53ms

E/BluetoothAdapter( 1095): Bluetooth binder is null

D/dalvikvm( 1095): GC_CONCURRENT freed 209K, 8% free 3793K/4088K, paused 2ms+16ms, total 65ms

D/        ( 1095): HostConnection::get() New Host Connection established 0xb82ef4c0, tid 1095

W/EGL_emulation( 1095): eglSurfaceAttrib not implemented

D/OpenGLRenderer( 1095): Enabling debug mode 0

I/ActivityManager(  357): Displayed com.android.settings/.Settings:
+2s599ms

D/dalvikvm( 1095): GC_CONCURRENT freed 124K, 5% free 4057K/4268K, paused 15ms+5ms, total 101ms

I/ActivityManager(  357): START u0 {act=android.intent.action.MAIN cmp=com.android.settings/.SubSettings (has extras)} from pid 1095

D/SubSettings( 1095): Launching fragment com.android.settings.accessibility.AccessibilitySettings

W/EGL_emulation( 1095): eglSurfaceAttrib not implemented

D/dalvikvm( 1095): GC_CONCURRENT freed 223K, 7% free 4267K/4576K, paused 20ms+65ms, total 345ms

I/Choreographer( 1095): Skipped 120 frames!  The application may be doing too much work on its main thread.

I/ActivityManager(  357): Displayed com.android.settings/.SubSettings:
+3s235ms

0 个答案:

没有答案