开发者

enable stack trace by default

When I do something like this:

try{
    row=inflater.inflate(R.layout.row2, parent, false);
}catch(Exception e){
    Log.e(TAG,"error",e);
}

I get a stacktrace like expected in LogCat. Without it however, the error is uncaught, but I still expect a trace in the unfiltered Log. But why isn't there? Without it, I see only an exeption state in the "Debug" tab (call stack?) There are places where a try..catch cannot be used, for example in an xml file.

Right now Im facing a runtime exception. The unfiltered log is this:

    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: com.android.internal.view.IInputMethodClient$Stub$Proxy@40c1d338
    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] 

I don't see any errors there, while the call stack shows: thread suspended (exception runtimeException))

This seems suspicious however:

09-06 20:48:24.545: INFO/DEBUG(2574): tid 11811 does not exist in pid 11805. ignoring debug request

When selecting the device to Debug on, the field "Debug" is empty for my phone it shows "yes" for an 1.6 emulator


If this code throws an exception and there is no exception handling anywhere in your code you would definitely see it in the logcat.


The problem was that the debugger halted on the exception, before the stacktrace was printed. So all you have to do is press the resume button(looking like i> ) in the debug panel a few times and the trace will be printed. When you see the force close dialog on your device, the trace must be in LogCat.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜