4

使用 LogCat 时,日志会显示 3 次。谁能解释为什么会这样?日志样本:

04-24 15:45:30.443: INFO/dalvikvm(351): Debugger has detached; object registry had 1 entries

04-24 15:45:30.434: DEBUG/jdwp(351): JDWP shutting down net...

04-24 15:45:30.443: INFO/dalvikvm(351): Debugger has detached; object registry had 1 entries

04-24 15:45:30.482: DEBUG/dalvikvm(351): VM cleaning up

04-24 15:45:30.503: ERROR/AndroidRuntime(351): ERROR: thread attach failed

04-24 15:45:30.482: DEBUG/dalvikvm(351): VM cleaning up

04-24 15:45:30.503: ERROR/AndroidRuntime(351): ERROR: thread attach failed

04-24 15:45:30.482: DEBUG/dalvikvm(351): VM cleaning up

04-24 15:45:30.503: ERROR/AndroidRuntime(351): ERROR: thread attach failed

04-24 15:45:30.973: DEBUG/dalvikvm(351): LinearAlloc 0x0 used 638428 of 5242880 (12%)
04-24 15:45:30.973: DEBUG/dalvikvm(351): LinearAlloc 0x0 used 638428 of 5242880 (12%)
04-24 15:45:30.973: DEBUG/dalvikvm(351): LinearAlloc 0x0 used 638428 of 5242880 (12%)

04-24 15:45:31.202: INFO/ActivityManager(59): Start proc com.nuktu.menu.sample for activity com.nuktu.menu.sample/.main: pid=358 uid=10041 gids={}

04-24 15:45:31.202: INFO/ActivityManager(59): Start proc com.nuktu.menu.sample for activity com.nuktu.menu.sample/.main: pid=358 uid=10041 gids={}

04-24 15:45:31.202: INFO/ActivityManager(59): Start proc com.nuktu.menu.sample for activity com.nuktu.menu.sample/.main: pid=358 uid=10041 gids={}

04-24 15:45:31.952: DEBUG/ddm-heap(358): Got feature list request
04-24 15:45:31.952: DEBUG/ddm-heap(358): Got feature list request
04-24 15:45:31.952: DEBUG/ddm-heap(358): Got feature list request

04-24 15:45:33.922: DEBUG/dalvikvm(233): GC freed 42 objects / 2000 bytes in 6457ms
04-24 15:45:33.922: DEBUG/dalvikvm(233): GC freed 42 objects / 2000 bytes in 6457ms
04-24 15:45:33.922: DEBUG/dalvikvm(233): GC freed 42 objects / 2000 bytes in 6457ms

04-24 15:45:34.953: INFO/ActivityManager(59): Displayed activity com.nuktu.menu.sample/.main: 4650 ms (total 4650 ms)
04-24 15:45:34.953: INFO/ActivityManager(59): Displayed activity com.nuktu.menu.sample/.main: 4650 ms (total 4650 ms)
04-24 15:45:34.953: INFO/ActivityManager(59): Displayed activity com.nuktu.menu.sample/.main: 4650 ms (total 4650 ms)

04-24 15:45:37.472: INFO/ActivityManager(59): Starting activity: Intent { cmp=com.nuktu.menu.sample/.NumTest }
04-24 15:45:37.472: INFO/ActivityManager(59): Starting activity: Intent { cmp=com.nuktu.menu.sample/.NumTest }
04-24 15:45:37.472: INFO/ActivityManager(59): Starting activity: Intent { cmp=com.nuktu.menu.sample/.NumTest }

04-24 15:45:37.932: VERBOSE/TAG(358): Oncreate method
04-24 15:45:37.932: VERBOSE/TAG(358): Oncreate method
04-24 15:45:37.962: VERBOSE/TAG(358): library set to null in oncreate
04-24 15:45:37.973: VERBOSE/TAG(358): define new image
04-24 15:45:37.983: VERBOSE/TAG(358): random number gotten
04-24 15:45:38.002: VERBOSE/TAG(358): ran_num 9

04-24 15:45:37.962: VERBOSE/TAG(358): library set to null in oncreate
04-24 15:45:37.973: VERBOSE/TAG(358): define new image
04-24 15:45:37.983: VERBOSE/TAG(358): random number gotten
04-24 15:45:38.002: VERBOSE/TAG(358): ran_num 9

04-24 15:45:37.932: VERBOSE/TAG(358): Oncreate method
04-24 15:45:37.962: VERBOSE/TAG(358): library set to null in oncreate
4

2 回答 2

5

这发生在我身上几次。尝试重置 DDMS(它是 Eclipse 中的一个隐藏选项,查找“屏幕截图”按钮旁边的向下箭头)。

于 2011-04-24T16:13:13.630 回答
0

如果您使用 Timber 等库进行日志记录,请检查您的 CustomApplication 类。您可能会多次初始化库,例如:

public class CustomApplication extends Application {
  @Override public void onCreate() {
    super.onCreate();

    if (BuildConfig.DEBUG) {
      Timber.plant(new DebugTree());
      Timber.plant(new DebugTree());
    }
  }
}
于 2020-01-06T16:58:39.887 回答