我有一个Android应用程序,它由一个运行4个线程的服务组成。我不认为其中一个线程崩溃(请参阅进一步说明)。但是我看到应用程序被杀了:它似乎只是消失了!
我的进程有pid 26580.在某个时间点(见12:11:29.440),我收到来自Android的日志消息: killProcessQuiet 。此后不久(同一时间戳,进一步的几条日志消息), ActivityManager提到:"不再需要phb.myapp(pid 26580)"还有另一条信息(12:11:29.450):"收件人26580"。
最后,我最后一次提到我的应用程序是来自ActivityManager的最后一次(12:11:29.460):"调度重启崩溃服务phb.myapp / .GPSLoggerService在5000毫秒"
在此之后我再也听不到我的过程了。请注意,目前我不想从onStartCommand返回START_STICKY,因为我仍在对应用进行故障排除。即使它是一个可能的解决方案(最终,我意识到,我将不得不继续运行),我想确保没有某些未捕获的异常。我怎么能确定没有?我希望如果Android系统日志中没有任何异常的痕迹,那我可以肯定吗?另一方面,为什么日志提及" 崩溃"服务?
(我保存了完整的日志,以防需要更多信息以获取可能的答案)
以后的(提取部分)系统日志:
... 09-09 12:10:24.050: D/phb.myapp.GPSPositionLoggerThread(26580): onLocationChanged() 09-09 12:10:24.050: D/PowerManagerService(383): releaseWakeLock(41e5a960): PARTIAL_WAKE_LOCK , tag=GCoreFlp, flags=0x1 09-09 12:10:24.060: D/AutoSetting(30943): service - mHandler: request passive update 09-09 12:10:24.060: D/AutoSetting(30943): service - handleMessage() incoming message, what:1 09-09 12:10:24.060: D/phb.myapp.GPSPositionStreamerThread(26580): _handleThreadMessage(STREAM_POSITION) ... 09-09 12:11:29.440: D/Process(383): killProcessQuiet, pid=26580 09-09 12:11:29.440: D/Process(383): dalvik.system.VMStack.getThreadStackTrace(Native Method) 09-09 12:11:29.440: D/Process(383): java.lang.Thread.getStackTrace(Thread.java:599) 09-09 12:11:29.440: D/Process(383): android.os.Process.killProcessQuiet(Process.java:986) 09-09 12:11:29.440: D/Process(383): com.android.server.am.ActivityManagerService.updateOomAdjLocked(ActivityManagerService.java:16273) 09-09 12:11:29.440: D/Process(383): com.android.server.am.ActivityManagerService.updateOomAdjLocked(ActivityManagerService.java:16176) 09-09 12:11:29.440: D/Process(383): com.android.server.am.ActivityManagerService.serviceDoneExecutingLocked(ActivityManagerService.java:13658) 09-09 12:11:29.440: D/Process(383): com.android.server.am.ActivityManagerService.serviceDoneExecuting(ActivityManagerService.java:13628) 09-09 12:11:29.440: D/Process(383): android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:788) 09-09 12:11:29.440: D/Process(383): com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:1887) 09-09 12:11:29.440: D/Process(383): android.os.Binder.execTransact(Binder.java:367) 09-09 12:11:29.440: D/Process(383): dalvik.system.NativeStart.run(Native Method) 09-09 12:11:29.440: I/ActivityManager(383): No longer want phb.myapp (pid 26580): hidden #16, adj=15 09-09 12:11:29.450: D/GpsLocationProvider(383): GPS status listener died 09-09 12:11:29.450: D/CarGpsProvider(383): GPS Mock status listener died 09-09 12:11:29.450: V/LocationManagerService(383): Location listener died 09-09 12:11:29.450: I/ActivityManager(383): Recipient 26580 ... 09-09 12:11:29.460: V/GpsLocationProvider(383): enableLocationTracking ++ 09-09 12:11:29.460: D/GpsLocationProvider(383): [handleMessage] message :9 09-09 12:11:29.460: D/GpsLocationProvider(383): [handleMessage] REMOVE_LISTENER 09-09 12:11:29.460: W/GpsLocationProvider(383): Unneeded remove listener for android.uid.system:1000 09-09 12:11:29.460: D/GpsLocationProvider(383): [handleMessage] message :3 09-09 12:11:29.460: D/GpsLocationProvider(383): [handleMessage] ENABLE_TRACKING 09-09 12:11:29.460: D/GpsLocationProvider(383): stopNavigating 09-09 12:11:29.460: D/GpsLocationProvider(383): stopNavigating: native_stop+ 09-09 12:11:29.460: V/LocationManagerService(383): _removeUpdates: listener = Receiver{41eca188 Listener android.os.BinderProxy@4127a9f0}mUpdateRecords: {gps=UpdateRecord {41e50d10 mProvider: gps mUid: 10206}} 09-09 12:11:29.460: W/ActivityManager(383): Scheduling restart of crashed service phb.myapp/.GPSLoggerService in 5000ms ... 09-09 12:11:30.870: I/THERMAL_GET_TEMP(143): Read adc from PROC_COMM: 1519 09-09 12:11:30.870: I/THERMAL_GET_TEMP(143): Adc: 1519, Millidegree Celsius: 34540 09-09 12:11:35.870: I/THERMAL_GET_TEMP(143): Read adc from PROC_COMM: 1539 09-09 12:11:35.870: I/THERMAL_GET_TEMP(143): Adc: 1539, Millidegree Celsius: 33521 09-09 12:11:40.870: I/THERMAL_GET_TEMP(143): Read adc from PROC_COMM: 1539 09-09 12:11:40.870: I/THERMAL_GET_TEMP(143): Adc: 1539, Millidegree Celsius: 33521
我的应用程序的日志:
09-09 12:05:14.050: D/phb.myapp.GPSPositionLoggerThread(26580): onLocationChanged()
09-09 12:05:14.050: D/phb.myapp.GPSPositionStreamerThread(26580): _handleThreadMessage(STREAM_POSITION)
09-09 12:06:02.050: D/phb.myapp.GPSPositionLoggerThread(26580): onLocationChanged()
09-09 12:06:02.070: D/phb.myapp.GPSPositionStreamerThread(26580): _handleThreadMessage(STREAM_POSITION)
09-09 12:07:41.070: D/phb.myapp.GPSPositionLoggerThread(26580): onLocationChanged()
09-09 12:07:41.080: D/phb.myapp.GPSPositionStreamerThread(26580): _handleThreadMessage(STREAM_POSITION)
09-09 12:08:43.060: D/phb.myapp.GPSPositionLoggerThread(26580): onLocationChanged()
09-09 12:08:43.060: D/phb.myapp.GPSPositionStreamerThread(26580): _handleThreadMessage(STREAM_POSITION)
09-09 12:09:29.070: D/phb.myapp.GPSPositionLoggerThread(26580): onLocationChanged()
09-09 12:09:29.070: D/phb.myapp.GPSPositionStreamerThread(26580): _handleThreadMessage(STREAM_POSITION)
09-09 12:10:24.050: D/phb.myapp.GPSPositionLoggerThread(26580): onLocationChanged()
09-09 12:10:24.060: D/phb.myapp.GPSPositionStreamerThread(26580): _handleThreadMessage(STREAM_POSITION)
(之后应用已死)