Reputation: 10977
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?
Upvotes: 25
Views: 9025
Reputation: 452
Following configuration worked for me for buildType release.
buildTypes {
release{
testCoverageEnabled = false
debuggable true
minifyEnabled false
shrinkResources false
}
Upvotes: 0
Reputation: 20675
I ran into this issue when trying to debug an app that was previously installed using an APK and not from Android Studio itself. Fixed it by uninstalling the app and re-run the debug.
Upvotes: 0
Reputation: 2732
I got sick of toggling testCoverageEnabled
when I wanted to debug so set up a project property to disable it when run from Android Studio, but default to enabled when run from command line with no options such as on a build box.
// Default to true, set -PtestCoverageEnabled=false in IDE compiler command-line options
def isTestCoverageEnabled = { ->
def enabled = project.hasProperty('testCoverageEnabled') ? testCoverageEnabled.toBoolean() : true
println "testCoverageEnabled = " + (enabled ? "true" : "false")
return enabled
}
android {
buildTypes {
debug {
testCoverageEnabled isTestCoverageEnabled()
}
}
}
To set the property in the IDE add the command-line option -PtestCoverageEnabled=false
Android Studio -> Preferences -> Build, Execution, Deployment -> Compiler -> Command-line Options
Upvotes: 1
Reputation: 1662
I don't have in my gradle file:
debug {
...
testCoverageEnabled true
}
but had the same issue on Android Studio 2.2. Solution that helped me to resolve issue:
Upvotes: 2
Reputation: 734
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.
Upvotes: 7
Reputation: 180
If your build uses the jack toolchain this can be the source of the problem. In my case, disabling jack solves the problem:
buildTypes {
...
debug {
jackOptions {
enabled false
}
}
}
Note: 1.8 source compatibility requires jack!
Upvotes: 1
Reputation: 996
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.
Upvotes: 39