Error when try generate a report: Task with path 'testDebug' not found in project ':app'.

3,175 views
Skip to first unread message

rider...@gmail.com

unread,
Feb 3, 2015, 12:17:50 PM2/3/15
to jac...@googlegroups.com
Error when try generate a report>

* What went wrong:
Could not determine the dependencies of task ':app:generateJacocoTestReports'.
> Task with path 'testDebug' not found in project ':app'.

Could someone help me?


apply plugin: 'jacoco'

def coverageSourceDirs = [ '../app/src/main/java' ]

android {
...
jacoco {
version "0.7.1.201405082137"
}
buildTypes {
debug {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable true
testCoverageEnabled = true

}
}

}

jacoco {
toolVersion "0.7.1.201405082137"
}

task generateJacocoTestReports(type:JacocoReport, dependsOn: "testDebug") {
group = "Reporting"
description = "Generate Jacoco Robolectric unit test coverage reports"

classDirectories = fileTree(
dir: '../app/build/intermediates/classes/debug',
excludes: ['**/R.class',
'**/R$*.class',
'**/*$ViewInjector*.*',
'**/BuildConfig.*',
'**/Manifest*.*']
)
sourceDirectories = files(coverageSourceDirs)
additionalSourceDirs = files(coverageSourceDirs)
executionData = files("$buildDir/jacoco/testDebug.exec")

// Bit hacky but fixes https://code.google.com/p/android/issues/detail?id=69174.
// We iterate through the compiled .class tree and rename $$ to $.
doFirst {
new File("$buildDir/intermediates/classes/").eachFileRecurse { file ->
if (file.name.contains('$$')) {
file.renameTo(file.path.replace('$$', '$'))
}
}
}
}

Marc R. Hoffmann

unread,
Feb 4, 2015, 12:03:33 AM2/4/15
to jac...@googlegroups.com
Hi,

this looks like a Gradle specific problem. As the Gradle plug-in is
maintained by the Gradle project itself you may find help there:

http://gradle.org/docs/current/userguide/jacoco_plugin.html
http://gradle.org/help-and-support

Regards,
-marc

Billy Lazzaro

unread,
Feb 4, 2015, 9:49:16 AM2/4/15
to jac...@googlegroups.com, rider...@gmail.com
If you run gradlew tasks do you have a testDebug? If you're using flavors you will need to change your dependsOn to match the flavor you're using. Something like, "test<flavor>Debug" or for instrumentation testcases "connectedAndroidTest<flavor>Debug".
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages