小编Ami*_*shi的帖子

无法在 android studio 上调试片段

我正在使用 Android-Studio,从上周开始,我无法在任何设置为 any 的断点处停下来fragment。如果我在活动中放置一个断点,调试器会按预期中断。如果调试器遇到如下一行:MyFragment f = new MyFragment();或任何引用片段的行,我按“进入”调试performs the actions but I still see the debugger stands on the lineMyFragment f = new MyFragment();`

此外,我注意到我在调试部分收到了这样的消息:

fragment = No such static field: 'fragment'
chgPicBtn = No such instance field: 'chgPicBtn'
Run Code Online (Sandbox Code Playgroud)

我不知道它是否相关,但值得一提。

我一直在网上寻找类似的问题,但一无所获。谢谢您的帮助

编辑:这是一个调用活动的函数:

public void displayView(int position) {

    String tag = "";
    fragment = null;
    switch (position) {
        case 0:
            fragment = new NewFragmentMain();
            if (chgPicBtn != null)
                chgPicBtn.setVisibility(View.GONE);
            tag = "NewFragmentMain";
            break;
        case 1: …
Run Code Online (Sandbox Code Playgroud)

android fragment android-fragments android-studio

5
推荐指数
0
解决办法
1921
查看次数