我正在使用Android-Studio,从上周开始,我无法在设置为任何fragment
的任何断点处停下来。
如果我在活动中设置了断点,则调试器会按预期中断。
如果调试器出现如下行:MyFragment f = new MyFragment();
或任何带有片段引用的行,我按“Step into”调试对象performs the actions but I still see the debugger stands on the line
MyFragment f = new MyFragment();`
此外,我注意到我在Debug部分得到了这样的消息:
fragment = No such static field: 'fragment'
chgPicBtn = No such instance field: 'chgPicBtn'
我不知道它是否相关,但值得一提。
我一直在网上寻找类似的问题而一无所获。 谢谢你的帮助
编辑: 这是一个调用活动的函数:
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:
fragment = EditProfileFragment.newInstance(!bool);
tag = "EditProfileFragment";
if (chgPicBtn != null)
chgPicBtn.setVisibility(View.VISIBLE);
break;
...
default:
break;
}
if (fragment != null) {
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.container_body, fragment, tag);
fragmentTransaction.addToBackStack(tag).commit();
}
}
NewFragmentMain的构造函数为空。
编辑:
问题是由于:
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
gradle文件中的。 我把它变成了假,一切都运转了。