Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot see parameter value in Android Studio when breakpoint is in first line of a method

Tags:

I am just switching from Eclipse to Android Studio and found this weird behavior. When I add a breakpoint in the first line of a method, I cannot see the parameter values. The only thing I can see then is the this reference. I either have to make one debug step or set the breakpoint to a line after the first one to see the parameter values.

Anyone else has this problem or knows what's going wrong here?

like image 302
SimonSays Avatar asked Jan 12 '15 19:01

SimonSays


People also ask

How do you view the value of a variable?

Hover over a variable to see its value. The most commonly used way to look at variables is the DataTip. When stopped in the debugger hover the mouse cursor over the variable you want to look at. The DataTip will appear showing you the value of that variable.

How do you debug a breakpoint?

To set a breakpoint in source code: Click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint. The breakpoint appears as a red dot in the left margin.


2 Answers

Try turning off your jacoco test coverage off for the debug build in your build.gradle file:

debug {     ...     testCoverageEnabled false } 

This completely fixed the issue for me where upgrading the gradle plugin did not.

like image 125
Rhys Davis Avatar answered Oct 24 '22 02:10

Rhys Davis


A good solution until AOSP Issue #123771 is solved, is to use the snippet provided by Stuart in the comments section:

buildTypes {     debug {         [...]         testCoverageEnabled true     }     release {         [...]     }     debuggable.initWith(buildTypes.debug)     debuggable {         testCoverageEnabled false     } } 

This way you can both keep your test coverage reports in your debug build and have a way of stepping through code seeing your local variables.

like image 28
Guillermo Orellana Ruiz Avatar answered Oct 24 '22 01:10

Guillermo Orellana Ruiz