为什么我不能在Android SDK中设置断点?

时间:2014-07-17 20:04:57

标签: android

我试图通过将断点放在

来找到我的应用的入口点
onCreate

在Activity.java中,但它从那时起就不会中断。这是允许的还是可能的?

这是我断点的地方

   protected void onCreate(Bundle savedInstanceState) {
        if (DEBUG_LIFECYCLE) Slog.v(TAG, "onCreate " + this + ": " + savedInstanceState);
        if (mLastNonConfigurationInstances != null) {
            mAllLoaderManagers = mLastNonConfigurationInstances.loaders;
        }
 --breakpoint here--->>>>>>>>          if (mActivityInfo.parentActivityName != null) {
            if (mActionBar == null) {
                mEnableDefaultActionBarUp = true;
            } else {
                mActionBar.setDefaultDisplayHomeAsUpEnabled(true);
            }
        }
        if (savedInstanceState != null) {
            Parcelable p = savedInstanceState.getParcelable(FRAGMENTS_TAG);
            mFragments.restoreAllState(p, mLastNonConfigurationInstances != null
                    ? mLastNonConfigurationInstances.fragments : null);
        }
        mFragments.dispatchCreate();
        getApplication().dispatchActivityCreated(this, savedInstanceState);
        mCalled = true;
    }

我试图打破super.onCreate(),但是当我介入时,它只是在里面的所有东西上步。

2 个答案:

答案 0 :(得分:1)

不,你不能把它放在方法声明语句中(我觉得这是正确的,没有用)。您可以将断点放在代码语句的函数中。

答案 1 :(得分:1)

以下是执行此操作的步骤。

To create a method breakpoint using the Breakpoints dialog
1) On the main menu, choose Run | View Breakpoints, or press Ctrl+Shift+F8.
2) In the Breakpoints dialog box that opens, click add.
3) Select Method Breakpoint from the drop-down list.
4) In the Add Method Breakpoint dialog box, specify the class name pattern, including the package name, and the name of the desired method.
5)So doing, when the debugging session starts, the application will pause in all classes with the names matching the specified pattern, at the specified method.

link会为您提供更多详情