堆棧跟蹤當我做這樣的事情:默認啓用
try{
row=inflater.inflate(R.layout.row2, parent, false);
}catch(Exception e){
Log.e(TAG,"error",e);
}
我得到一個堆棧跟蹤像預計在logcat中。 但是,沒有它,錯誤未被捕獲,但我仍然期望在未過濾的日誌中有一個跟蹤。但爲什麼不在那裏?沒有它,我只在「調試」選項卡(調用堆棧?)中看到一個exeption狀態。有些地方try..catch不能使用,例如在xml文件中。
現在我面臨運行時異常。未過濾的日誌是這樣的:
09-06 20:48:22.760: DEBUG/dalvikvm(11430): GC_EXPLICIT freed 100K, 51% free 2658K/5379K, external 0K/0K, paused 97ms
09-06 20:48:24.329: DEBUG/AndroidRuntime(11805): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
09-06 20:48:24.329: DEBUG/AndroidRuntime(11805): CheckJNI is OFF
09-06 20:48:24.329: DEBUG/AndroidRuntime(11805): setted country_code = The Netherlands
09-06 20:48:24.329: DEBUG/AndroidRuntime(11805): setted sales_code = XEN
09-06 20:48:24.334: DEBUG/AndroidRuntime(11805): found sales_code tag = <XEN>, </XEN>
09-06 20:48:24.334: DEBUG/dalvikvm(11805): creating instr width table
09-06 20:48:24.404: DEBUG/LibQmg_native(11805): register_android_app_LibQmg
09-06 20:48:24.409: DEBUG/DeviceEncryption(11805): JNI: register_android_deviceencryption_DeviceEncryptionManager
09-06 20:48:24.430: DEBUG/AndroidRuntime(11805): Calling main entry com.android.commands.pm.Pm
09-06 20:48:24.435: DEBUG/AndroidRuntime(11805): Shutting down VM
09-06 20:48:24.435: DEBUG/dalvikvm(11805): GC_CONCURRENT freed 105K, 69% free 317K/1024K, external 0K/0K, paused 0ms+0ms
09-06 20:48:24.435: DEBUG/dalvikvm(11805): Debugger has detached; object registry had 1 entries
09-06 20:48:24.525: DEBUG/AndroidRuntime(11813): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
09-06 20:48:24.525: DEBUG/AndroidRuntime(11813): CheckJNI is OFF
09-06 20:48:24.525: DEBUG/AndroidRuntime(11813): setted country_code = The Netherlands
09-06 20:48:24.525: DEBUG/AndroidRuntime(11813): setted sales_code = XEN
09-06 20:48:24.525: DEBUG/AndroidRuntime(11813): found sales_code tag = <XEN>, </XEN>
09-06 20:48:24.530: DEBUG/dalvikvm(11813): creating instr width table
09-06 20:48:24.545: INFO/DEBUG(2574): tid 11811 does not exist in pid 11805. ignoring debug request
09-06 20:48:24.595: DEBUG/LibQmg_native(11813): register_android_app_LibQmg
09-06 20:48:24.595: DEBUG/DeviceEncryption(11813): JNI: register_android_deviceencryption_DeviceEncryptionManager
09-06 20:48:24.620: DEBUG/AndroidRuntime(11813): Calling main entry com.android.commands.am.Am
09-06 20:48:24.620: INFO/Process(2786): Sending signal. PID: 11793 SIG: 9
09-06 20:48:24.620: INFO/ActivityManager(2786): Force stopping package com.commonsware.cwac.tlv.demo uid=10111
09-06 20:48:24.630: WARN/InputManagerService(2786): Window already focused, ignoring focus gain of: [email protected]
09-06 20:48:24.645: DEBUG/AndroidRuntime(11813): Shutting down VM
09-06 20:48:24.645: DEBUG/dalvikvm(11813): GC_CONCURRENT freed 106K, 67% free 345K/1024K, external 0K/0K, paused 0ms+0ms
09-06 20:48:24.645: INFO/ActivityManager(2786): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.commonsware.cwac.tlv.demo/.TouchListViewDemo } from pid 11813
09-06 20:48:24.650: DEBUG/dalvikvm(11813): Debugger has detached; object registry had 1 entries
09-06 20:48:24.675: INFO/ActivityManager(2786): Start proc com.commonsware.cwac.tlv.demo for activity com.commonsware.cwac.tlv.demo/.TouchListViewDemo: pid=11823 uid=10111 gids={1015}
09-06 20:48:24.700: DEBUG/dalvikvm(11823): Debugger has detached; object registry had 1 entries
09-06 20:48:24.705: WARN/ActivityThread(11823): Application com.commonsware.cwac.tlv.demo is waiting for the debugger on port 8100...
09-06 20:48:24.710: INFO/System.out(11823): Sending WAIT chunk
09-06 20:48:24.760: INFO/DEBUG(2574): tid 11819 does not exist in pid 11813. ignoring debug request
09-06 20:48:25.205: WARN/ActivityManager(2786): Activity pause timeout for HistoryRecord{40c0b380 com.commonsware.cwac.tlv.demo/.TouchListViewDemo}
09-06 20:48:25.734: INFO/dalvikvm(11823): Debugger is active
09-06 20:48:25.919: INFO/System.out(11823): Debugger has connected
09-06 20:48:25.919: INFO/System.out(11823): waiting for debugger to settle...
09-06 20:48:26.120: INFO/System.out(11823): waiting for debugger to settle...
09-06 20:48:26.324: INFO/System.out(11823): waiting for debugger to settle...
09-06 20:48:26.524: INFO/System.out(11823): waiting for debugger to settle...
09-06 20:48:26.724: INFO/System.out(11823): waiting for debugger to settle...
09-06 20:48:26.930: INFO/System.out(11823): waiting for debugger to settle...
09-06 20:48:27.130: INFO/System.out(11823): waiting for debugger to settle...
09-06 20:48:27.324: INFO/System.out(11823): waiting for debugger to settle...
09-06 20:48:27.530: INFO/System.out(11823): waiting for debugger to settle...
09-06 20:48:27.729: INFO/System.out(11823): waiting for debugger to settle...
09-06 20:48:27.930: INFO/System.out(11823): debugger has settled (1398)
09-06 20:48:28.445: DEBUG/gps_sirf(2786): sirf_gps_inject_location: called
09-06 20:48:28.505: INFO/wpa_supplicant(24796): SCAN_RESULTS : [5]
09-06 20:48:30.100: VERBOSE/WifiMonitor(2786): Event [ SCAN-RESULTS ]
09-06 20:48:30.105: INFO/wpa_supplicant(24796): SCAN_RESULTS : [5]
09-06 20:48:30.120: INFO/wpa_supplicant(24796): SCAN_RESULTS : [5]
09-06 20:48:30.134: DEBUG/gps_sirf(2786): sirf_gps_inject_location: called
09-06 20:48:30.160: INFO/wpa_supplicant(24796): SCAN_RESULTS : [5]
我看不出有任何錯誤出現,而調用堆棧顯示:線程掛起(例外的RuntimeException))
這似乎可疑但是:
09- 06 20:48:24.545:INFO/DEBUG(2574):tid 11811不存在於pid 11805中。忽略調試請求
選擇要調試的設備時,「調試」字段爲空,對於1.6仿真器「是」
你沒有任何機會使用自定義異常處理程序類,是嗎? – Macondo2Seattle
首先,沒有地方不能使用try/catch。不過,我對你的問題感到驚訝,因爲當拋出異常並且我沒有明確地捕獲並記錄它時,我仍然在LogCat中看到它。 –