(Android Studio) 如何仅通过我的代码进行调试?

(Android Studio) 如何仅通过我的代码进行调试?

问题描述:

当我尝试在 Android 中调试我的代码时(使用 Step Into、F7 命令),调试器会带我浏览所有我不想要的系统类.

When I try to debug through my code in Android (using Step Into, F7 command), the debugger takes me through all system classes, which I do not want.

例如,当我在下面的第 2 行(即startActivity(ourIntent);")放置断点时,执行点不会进入我的 Activity(即myclass)",而是进入 Activity.java > Instrumentation.java等...所有系统类.

For example, when I place a breakpoint at the 2nd line below (i.e. "startActivity(ourIntent);"), instead of going into my Activity (i.e. "myclass), the execution point goes into Activity.java > Instrumentation.java, etc... all system classes.

我不想那样.我只想单步执行我编写的代码.

I dont want that. I only want to step through my code that I have written.

实现这一目标的方法是什么?

What is a way to achieve this?

        Intent ourIntent = new Intent(MainActivity.this, "com.practice.gamesbook.myclass");
        startActivity(ourIntent);

调试器"下的添加新模式"选项>步进"已禁用

"Add new Pattern" option under "Debugger" > "Stepping" is disabled

转到 Android Studio >首选项 >调试器Stepping 然后在底部单击带有问号的加号箭头,上面写着 Add Pattern.输入 android.* 并点击 OK 然后应用.

Go to Android Studio > Preferences > Debugger > Stepping then in the bottom click the plus arrow with the question mark that says Add Pattern. Type android.* and hit OK and then Apply.