我写了一个小时钟部件.像所有的时钟一样,它必须每分钟更新一次.所以我设置了一个闹钟来做到这一点.工作正常这只是一点点太小所以我提出了一个
XML属性,并再次尝试.它强制关闭.我把属性改回原来,再试一次.它再次强行关闭.
LogCat跟随(从包安装到操作系统杀死它):
01-19 13:38:52.292: DEBUG/PackageManager(57): New package installed in /data/app/com.---.clock-2.apk 01-19 13:38:52.571: INFO/ActivityManager(57): Force stopping package com.---.clock uid=10043 01-19 13:38:52.571: INFO/Process(57): Sending signal. PID: 593 SIG: 9 01-19 13:38:52.612: INFO/ActivityManager(57): Force stopping package com.---.clock uid=10043 01-19 13:38:53.022: DEBUG/PhotoAppWidgetProvider(282): getPhoto query count=0 01-19 13:38:53.022: DEBUG/PhotoAppWidgetProvider(282): sending out views=null for id=0 01-19 13:38:53.131: INFO/ActivityManager(57): Start proc com.---.clock for broadcast com.---.clock/.Clock: pid=613 uid=10043 gids={1015} 01-19 13:38:53.713: DEBUG/Clock widget(613): updated 01-19 13:38:54.011: INFO/ActivityManager(57): Force stopping package com.---.clock uid=10043 01-19 13:38:54.021: INFO/Process(57): Sending signal. PID: 613 SIG: 9 01-19 13:38:54.301: DEBUG/dalvikvm(121): GC_EXPLICIT freed 13673 objects / 524360 bytes in 177ms 01-19 13:38:54.542: DEBUG/dalvikvm(125): GC_EXPLICIT freed 4956 objects / 200960 bytes in 440ms 01-19 13:38:54.801: WARN/RecognitionManagerService(57): no available voice recognition services found 01-19 13:38:55.032: DEBUG/dalvikvm(57): GC_EXPLICIT freed 4960 objects / 290104 bytes in 201ms 01-19 13:38:55.042: INFO/installd(35): unlink /data/dalvik-cache/data@app@com.---.clock-1.apk@classes.dex 01-19 13:38:55.131: DEBUG/AndroidRuntime(605): Shutting down VM 01-19 13:38:55.151: DEBUG/dalvikvm(605): Debugger has detached; object registry had 1 entries 01-19 13:38:55.212: INFO/AndroidRuntime(605): NOTE: attach of thread 'Binder Thread #3' Failed 01-19 13:38:55.571: DEBUG/PhotoAppWidgetProvider(282): getPhoto query count=0 01-19 13:38:55.571: DEBUG/PhotoAppWidgetProvider(282): sending out views=null for id=0 01-19 13:38:55.762: INFO/ActivityManager(57): Start proc com.---.clock for broadcast com.---.clock/.Clock: pid=622 uid=10043 gids={1015} 01-19 13:38:56.332: WARN/asset(622): Asset path /data/app/com.---.clock-1.apk is neither a directory nor file (type=1). 01-19 13:38:56.373: DEBUG/AndroidRuntime(622): Shutting down VM 01-19 13:38:56.373: WARN/dalvikvm(622): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 01-19 13:38:56.722: DEBUG/PhotoAppWidgetProvider(282): getPhoto query count=0 01-19 13:38:56.732: DEBUG/PhotoAppWidgetProvider(282): sending out views=null for id=0 01-19 13:38:56.841: ERROR/AndroidRuntime(622): FATAL EXCEPTION: main 01-19 13:38:56.841: ERROR/AndroidRuntime(622): java.lang.RuntimeException: Unable to instantiate receiver com.---.clock.Clock: java.lang.ClassNotFoundException: com.---.clock.Clock in loader dalvik.system.PathClassLoader[/data/app/com.---.clock-1.apk] 01-19 13:38:56.841: ERROR/AndroidRuntime(622): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2789) 01-19 13:38:56.841: ERROR/AndroidRuntime(622): at android.app.ActivityThread.access$3200(ActivityThread.java:125) 01-19 13:38:56.841: ERROR/AndroidRuntime(622): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2083) 01-19 13:38:56.841: ERROR/AndroidRuntime(622): at android.os.Handler.dispatchMessage(Handler.java:99) 01-19 13:38:56.841: ERROR/AndroidRuntime(622): at android.os.Looper.loop(Looper.java:123) 01-19 13:38:56.841: ERROR/AndroidRuntime(622): at android.app.ActivityThread.main(ActivityThread.java:4627) 01-19 13:38:56.841: ERROR/AndroidRuntime(622): at java.lang.reflect.Method.invokeNative(Native Method) 01-19 13:38:56.841: ERROR/AndroidRuntime(622): at java.lang.reflect.Method.invoke(Method.java:521) 01-19 13:38:56.841: ERROR/AndroidRuntime(622): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 01-19 13:38:56.841: ERROR/AndroidRuntime(622): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 01-19 13:38:56.841: ERROR/AndroidRuntime(622): at dalvik.system.NativeStart.main(Native Method) 01-19 13:38:56.841: ERROR/AndroidRuntime(622): Caused by: java.lang.ClassNotFoundException: com.---.clock.Clock in loader dalvik.system.PathClassLoader[/data/app/com.---.clock-1.apk] 01-19 13:38:56.841: ERROR/AndroidRuntime(622): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243) 01-19 13:38:56.841: ERROR/AndroidRuntime(622): at java.lang.ClassLoader.loadClass(ClassLoader.java:573) 01-19 13:38:56.841: ERROR/AndroidRuntime(622): at java.lang.ClassLoader.loadClass(ClassLoader.java:532) 01-19 13:38:56.841: ERROR/AndroidRuntime(622): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2780) 01-19 13:38:56.841: ERROR/AndroidRuntime(622): ... 10 more 01-19 13:38:56.901: WARN/asset(57): Asset path /data/app/com.---.clock-1.apk is neither a directory nor file (type=1). 01-19 13:38:56.913: WARN/PackageManager(57): Failure retrieving resources forcom.---.clock 01-19 13:38:57.932: DEBUG/PhotoAppWidgetProvider(282): getPhoto query count=0 01-19 13:38:58.003: DEBUG/PhotoAppWidgetProvider(282): sending out views=null for id=0 01-19 13:39:05.101: INFO/Process(622): Sending signal. PID: 622 SIG: 9 01-19 13:39:05.151: INFO/ActivityManager(57): Process com.---.clock (pid 622) has died. 01-19 13:39:05.182: WARN/InputManagerService(57): Window already focused,ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@43ecc698 01-19 13:39:05.892: DEBUG/PhotoAppWidgetProvider(282): getPhoto query count=0 01-19 13:39:05.892: DEBUG/PhotoAppWidgetProvider(282): sending out views=null for id=0 01-19 13:39:06.011: INFO/ActivityManager(57): Start proc com.---.clock for broadcast com.---.clock/.Clock: pid=630 uid=10043 gids={1015} 01-19 13:39:06.413: WARN/asset(630): Asset path /data/app/com.---.clock-1.apk is neither a directory nor file (type=1). 01-19 13:39:06.472: DEBUG/AndroidRuntime(630): Shutting down VM 01-19 13:39:06.482: WARN/dalvikvm(630): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 01-19 13:39:06.901: ERROR/AndroidRuntime(630): FATAL EXCEPTION: main 01-19 13:39:06.901: ERROR/AndroidRuntime(630): java.lang.RuntimeException: Unable to instantiate receiver com.---.clock.Clock: java.lang.ClassNotFoundException: com.---.clock.Clock in loader dalvik.system.PathClassLoader[/data/app/com.---.clock-1.apk] 01-19 13:39:06.901: ERROR/AndroidRuntime(630): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2789) 01-19 13:39:06.901: ERROR/AndroidRuntime(630): at android.app.ActivityThread.access$3200(ActivityThread.java:125) 01-19 13:39:06.901: ERROR/AndroidRuntime(630): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2083) 01-19 13:39:06.901: ERROR/AndroidRuntime(630): at android.os.Handler.dispatchMessage(Handler.java:99) 01-19 13:39:06.901: ERROR/AndroidRuntime(630): at android.os.Looper.loop(Looper.java:123) 01-19 13:39:06.901: ERROR/AndroidRuntime(630): at android.app.ActivityThread.main(ActivityThread.java:4627) 01-19 13:39:06.901: ERROR/AndroidRuntime(630): at java.lang.reflect.Method.invokeNative(Native Method) 01-19 13:39:06.901: ERROR/AndroidRuntime(630): at java.lang.reflect.Method.invoke(Method.java:521) 01-19 13:39:06.901: ERROR/AndroidRuntime(630): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 01-19 13:39:06.901: ERROR/AndroidRuntime(630): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 01-19 13:39:06.901: ERROR/AndroidRuntime(630): at dalvik.system.NativeStart.main(Native Method) 01-19 13:39:06.901: ERROR/AndroidRuntime(630): Caused by: java.lang.ClassNotFoundException: com.---.clock.Clock in loader dalvik.system.PathClassLoader[/data/app/com.---.clock-1.apk] 01-19 13:39:06.901: ERROR/AndroidRuntime(630): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243) 01-19 13:39:06.901: ERROR/AndroidRuntime(630): at java.lang.ClassLoader.loadClass(ClassLoader.java:573) 01-19 13:39:06.901: ERROR/AndroidRuntime(630): at java.lang.ClassLoader.loadClass(ClassLoader.java:532) 01-19 13:39:06.901: ERROR/AndroidRuntime(630): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2780) 01-19 13:39:06.901: ERROR/AndroidRuntime(630): ... 10 more 01-19 13:39:06.901: DEBUG/PhotoAppWidgetProvider(282): getPhoto query count=0 01-19 13:39:06.922: DEBUG/PhotoAppWidgetProvider(282): sending out views=null for id=0 01-19 13:39:07.051: WARN/ActivityManager(57): Process com.---.clock has crashed too many times: killing! 01-19 13:39:07.062: INFO/Process(57): Sending signal. PID: 630 SIG: 9 01-19 13:39:07.151: WARN/ActivityManager(57): Unable to launch app com.---.clock/10043 for broadcast Intent { act=android.appwidget.action.APPWIDGET_UPDATE cmp=com.---.clock/.Clock (has extras) }: process is bad 01-19 13:39:07.151: WARN/ActivityManager(57): finishReceiver called but none active
解决方法
无论什么原因,(
MAGIC!)重启仿真器工作.我仍然不知道为什么它会混乱在第一位,但重新启动工作.