我试图在断点时判断变量的值,但Android Studio说我的变量"states
已优化"[原文如此].
val states = mutableListOf<UiState>()
backgroundScope.launch(Dispatchers.Unconfined) {
viewModel.uiState.toList(states)
}
assertEquals(true, states[0].isLoading)
// Breakpoint here
viewModel.fooBarBaz()
我知道我可以设置一个更高的断点,或者在使用变量的断点下面添加一行代码--就像一条print语句,但这太烦人了.我如何告诉Android Studio不要优化我的局部变量?