After Updating the android version 1.5 to 2.0 Preview4. Android studio Debugger unable to find the local variable defined in method definition. For reference, find the below screenshot.
-
if this solved your pboelm , could you accept the answer. – Raymond Chenon Apr 12 '16 at 16:47
7 Answers
In your gradle, do you enable test coverage ?
buildTypes {
debug {
testCoverageEnabled = true
}
}
Set testCoverageEnabled = false
, it fixed the issue.
https://code.google.com/p/android/issues/detail?id=78045

- 11,482
- 15
- 77
- 110
-
-
-
2Thanks, this worked for me! Ended up creating a boolean based on if the build is running on a dev machine or a CICD server (based on the presence of environment variables in our build environment) so it can still provide test coverage reports on a build pipeline. – Ani Fichadia Nov 24 '16 at 06:31
-
@AniFichadia good idea. We do similar : set a environment variable on the CI , if this env. var. is not present ( on a developer's machine) the boolean default value is false. – Raymond Chenon Nov 24 '16 at 09:59
-
1
-
In my case I had to put it to true when using jacoco if I want jacoco to produce coverage report. Put it back to false otherwise. Yeay! – Greg Feb 09 '18 at 12:44
-
I tried `create("customDebugType") {debuggable = true}` with and without `testCoverageEnabled = false`. I still get a wall of `view = Cannot find local variable 'view'` until it's done executing. I'm strugging to simply setup the ClickListener, and the items in the RecyclerView don't appear. – N.Barrett Dec 04 '22 at 02:46
Make sure you are not building a 'Release'
Build Variant. You will get above warning when it is a Release Build.

- 2,963
- 1
- 36
- 40
if you have minifyEnabled true in
debug { minifyEnabled true debuggable true }
remove that and using just like that debug { debuggable true }
its work for me

- 327
- 4
- 8
Disable jack for debug build type (build.gradle):
buildTypes {
...
debug {
jackOptions {
enabled false
}
}
}
Note: 1.8 source compatibility requires jack!

- 180
- 2
- 5
-
-
No. It is possible to debug with java 1.8 and jack (breakpoints, step by step execution, etc.), but the values of the local variables are nor shown. Please note: my solution is a workaround not a resolution of the problem! – Miklós Keresztes Jul 22 '16 at 15:45
-
@Dori Android issue #93730 was closed as duplicate of another unrelated issue. I've created https://code.google.com/p/android/issues/detail?id=219615 as new issue related to "As soon as Jack & Jill are enabled, Android Studio does not show local variables and is unable to set breakpoints in library projects". – Flow Aug 09 '16 at 09:25
You can try this solution - open the Android Device Monitor, do a 'Reset adb'.
A screenshot where to find 'Reset adb'.

- 131
- 16

- 435
- 4
- 17
Make sure that you build configuration with debuggable flag.
buildTypes {
debug {
minifyEnabled false
debuggable true
}
}

- 2,027
- 21
- 26
I got the problem , it was in build.gradle file
buildTypes { debug{ minifyEnabled true //This was the problem , make it false
}
release{
}
}

- 1,564
- 16
- 26