16

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.

enter image description here

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

reducing activity
  • 1,985
  • 2
  • 36
  • 64
  • Add your sample code block to provide minimal reproduction of your test. – Giddy Naya Dec 20 '19 at 18:56
  • Did you ever fix this? – clavio Apr 17 '20 at 14:13
  • @GiddyNaya: A sample code block does not help as this is some configuration issue. If you don't have the configuration issue you will not have the same problem. I just had this issue crop up and am entirely unable to fix it, despite the exact same system and code working yesterday with debugging being totally functional. Any function call with locally scoped variables just cannot be debugged in Kotlin classes, and its inconsistent. – Matthew Bahr Jul 22 '20 at 15:30
  • @MatthewBahr I too am struggling with this problem. Another person who is trying to help me, also suggested it's a configuration issue. I encountered it right when I started using the debugger. I don't know if you've researched solutions to it, but like you, I can't fix it, at least so far. – N.Barrett Dec 15 '22 at 23:43
  • It's been a while and I'm working in an entirely different setup now but as I recall I ended up uninstalling AS and reinstalling. It might have been an issue with ADB as well. It was a really frustrating issue. Is your AS install fully up to date? – Matthew Bahr Dec 17 '22 at 04:06

0 Answers0