问题
Typically, variables are shown in the debug mode in Android Studio (version 3.5.2). But sometimes, as I step through a program I suddenly get "Variables are not available" (see the image below). This time I get this within code where a bug is present, so I really want to know what is happening there.
It is happening during running a test in the debug mode (not Android Test, and not running in emulator and/or on the device).
How can I fix this?
I used Run -> Build to rebuild project
I used "Invalidate caches and restart"
I noticed that I am setting breakpoint in the test that is calling target function exactly once. In this case I can set breakpoint directly within function. I tried that and still got "Variables not available"
I am not running tests with a coverage.
My build.gradle
is without minifyEnabled true
or testCoverageEnabled = true
(and https://issuetracker.google.com/issues/37017550 is anyway fixed many versions before AS 3.5.2)
Not a duplicate of In Android Studio 2.0, Cannot find local variable of method in debug mode as I am not using the now ancient Android Studio 2.0
Not a duplicate of Android Studio 2.1 does not show local variables when debugging or Android Studio 2.1 debugger does not show local variables as I am not using the now ancient Android Studio 2.1
Not a duplicate of Android Studio Variables not appearing as variables are within scope - and I get explicit message that Android Studio is refusing to show any variables
Not a duplicate of Debugger is not showing values of variables in Android Studio as debugger is showing stepping through a relevant code
Not a duplicate of android debugger - what is the relation between frame and thread? Does breakpoint work differently in different places? as it asking about terminology
来源:https://stackoverflow.com/questions/59287737/variables-are-not-available-appearing-sometimes-during-debugging-on-stepping