通常,变量在 Android Studio(版本 3.5.2)的调试模式下显示。但有时,当我单步执行程序时,我突然得到“变量不可用”(见下图)。这次我在存在错误的代码中得到了这个,所以我真的很想知道那里发生了什么。
它是在调试模式下运行测试期间发生的(不是 Android 测试,并且不在模拟器和/或设备上运行)。
我怎样才能解决这个问题?
我使用 Run -> Build 来重建项目
我使用了“使缓存无效并重新启动”
我注意到我在测试中设置断点,只调用一次目标函数。在这种情况下,我可以直接在函数内设置断点。我尝试过,但仍然得到“变量不可用”
我没有运行覆盖范围的测试。
My build.gradle
是没有minifyEnabled true
or testCoverageEnabled = true
(and https://issuetracker.google.com/issues/37017550 https://issuetracker.google.com/issues/37017550无论如何修复了 AS 3.5.2 之前的许多版本)
不是重复的在Android Studio 2.0中,在调试模式下找不到方法的局部变量 https://stackoverflow.com/questions/34566901/in-android-studio-2-0-cannot-find-local-variable-of-method-in-debug-mode因为我没有使用现在古老的 Android Studio 2.0
不是重复的Android Studio 2.1 调试时不显示局部变量 https://stackoverflow.com/questions/37029534/android-studio-does-not-show-local-variables-when-debugging or Android Studio 2.1 调试器不显示局部变量 https://stackoverflow.com/questions/37142275因为我没有使用现在古老的 Android Studio 2.1
不是重复的Android Studio 变量未出现 https://stackoverflow.com/questions/58105131/android-studio-variables-not-appearing因为变量在范围内 - 我收到明确的消息,表明 Android Studio 拒绝显示任何变量
不是重复的调试器未在 Android Studio 中显示变量值 https://stackoverflow.com/questions/55949739/debugger-is-not-showing-values-of-variables-in-android-studio当调试器显示单步执行相关代码时
不是重复的android 调试器 - 框架和线程之间的关系是什么?断点在不同地方的工作方式是否不同? https://stackoverflow.com/questions/50093961当它询问术语时