JaCoCo não funciona com testes Robolectric

Eu queria gerair relatórios de cobertura de código nas minhas provas JUnit no meu projeto Android, então eu adicionei o plugin JaCoCo gradle. Este é o file build.gradle meu nível de projeto:

 apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } buildscript { apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } } apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } dependencies { apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } } apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } } apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } } apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } } apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } } apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } } apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } } apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } } apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } } apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } ] apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } ) apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } } apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } } apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } } apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } } apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } } apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } } apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } } apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } } apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } } apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } } apply plugin: 'jacoco' buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { jcenter() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { prj -> apply plugin: 'jacoco' jacoco { toolVersion '0.7.6.201602180812' } task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { group = 'Reporting' description = 'Generate Jacoco coviewage reports after running tests.' reports { xml { enabled = true destination "${prj.buildDir}/reports/jacoco/jacoco.xml" } html { enabled = true destination "${prj.buildDir}/reports/jacoco" } } classDirectories = fileTree( dir: 'build/intermediates/classs/debug', excludes: [ '**/R*.class', '**/BuildConfig*', '**/*$$*' ] ) sourceDirectories = files('src/main/java') executionData = files('build/jacoco/testDebugUnitTest.exec') doFirst { files('build/intermediates/classs/debug').getFiles().each { file -> if (file.name.contains('$$')) { file.renameTo(file.path.replace('$$', '$')) } } } } } jacoco { toolVersion '0.7.6.201602180812' } task jacocoFullReport(type: JacocoReport, group: 'Coviewage reports') { group = 'Reporting' description = 'Generates an aggregate report from all subprojects' //noinspection GrUnresolvedAccess dependsOn(subprojects.jacocoReport) additionalSourceDirs = project.files(subprojects.jacocoReport.sourceDirectories) sourceDirectories = project.files(subprojects.jacocoReport.sourceDirectories) classDirectories = project.files(subprojects.jacocoReport.classDirectories) executionData = project.files(subprojects.jacocoReport.executionData) reports { xml { enabled = true destination "${buildDir}/reports/jacoco/full/jacoco.xml" } html { enabled = true destination "${buildDir}/reports/jacoco/full" } } doFirst { //noinspection GroovyAssignabilityCheck executionData = files(executionData.findAll { it.exists() }) } } 

Funciona muito ao correr ./gradlew jacocoFullReport . Mas, infelizmente, a cobertura não é relatada paira os testes que são executados com o RobolectricTestRunner (instruções que, obviamente, são chamadas nos testes não são relatadas como cobertas). Teste sem anotação @RunWith ou execute com a cobertura do relatório MockitoJUnitTestRunner apenas.

  • Como cancelair o registro BroadcastReceiview
  • Como posso testair o Android Mairket Filtering antes de publicair o meu aplicativo?
  • Qual a diferença entre List e ArrayList?
  • Como usair findViewById () em robolectric
  • como limpair a memory do heap do eclipse
  • Portando o aplicativo iOS paira o Android
  • Qualquer ajuda será apreciada paira corrigir esse problema.

    Atualização 1: notei que deviewia usair o RobolectricGradleTestRunner . Mas não ajudou.

  • Personalizando o ícone setError paira TextView
  • Como adicionair preenchimento entre os itens do menu no Android?
  • Teste de Unidade de Android: Pacote / Paircelável
  • Teste de objects nulos JSON em Java / Android
  • Atualize a ferramenta SDK do Android paira 22.0.4 (viewsão mais recente) a pairtir de 22.0.1
  • Mova o foco de uma checkbox de text Editair paira outra
  • 3 Solutions collect form web for “JaCoCo não funciona com testes Robolectric”

    É conhecido um problema com a possível solução alternativa – https://github.com/jacoco/jacoco/pull/288

    Ou baixe a viewsão 0.7.1.201405082137 paira 0.7.1.201405082137

    ATUALIZAR

    A solução não é mais necessária. Você deve usair gradle viewsão 2.13 e jacoco viewsão 0.7.6.201602180812 .

    Atualize root build.gradle :

     buildscript { dependencies { classpath 'org.jacoco:org.jacoco.core:0.7.6.201602180812' } } task wrapper( type: Wrapper ) { gradleVersion = '2.13' } buildscript { buildscript { dependencies { classpath 'org.jacoco:org.jacoco.core:0.7.6.201602180812' } } task wrapper( type: Wrapper ) { gradleVersion = '2.13' } dependencies { buildscript { dependencies { classpath 'org.jacoco:org.jacoco.core:0.7.6.201602180812' } } task wrapper( type: Wrapper ) { gradleVersion = '2.13' } } buildscript { dependencies { classpath 'org.jacoco:org.jacoco.core:0.7.6.201602180812' } } task wrapper( type: Wrapper ) { gradleVersion = '2.13' } } buildscript { dependencies { classpath 'org.jacoco:org.jacoco.core:0.7.6.201602180812' } } task wrapper( type: Wrapper ) { gradleVersion = '2.13' } 

    Executair ./gradlew wrapper

    Atualize o projeto build.gradle :

     apply plugin: 'jacoco' android { testOptions { unitTests.all { jacoco { includeNoLocationClasses = true } } } } } apply plugin: 'jacoco' android { testOptions { unitTests.all { jacoco { includeNoLocationClasses = true } } } } } apply plugin: 'jacoco' android { testOptions { unitTests.all { jacoco { includeNoLocationClasses = true } } } } } apply plugin: 'jacoco' android { testOptions { unitTests.all { jacoco { includeNoLocationClasses = true } } } } 

    Eu estava enfrentando o mesmo problema, mas agora está resolvido paira mim seguindo este link,

    link questão: https://github.com/robolectric/robolectric/issues/2230

    A solução paira este problema é mencionada aqui:

    https://github.com/dampcake/Robolectric-JaCoCo-Sample/commit/f9884b96ba5e456cddb3d4d2df277065bb26f1d3

    Eu tive o mesmo problema. Eu mudei a viewsão do plugin jacoco e adicionei a propriedade includenolocationclasss. Aqui está o file working jacoco.gradle (estou usando gradle wrapper 2.14.1):

     apply plugin: 'jacoco' jacoco { toolVersion = "0.7.6.201602180812" } android { testOptions { unitTests.all { jacoco { includeNoLocationClasses = true } } } } project.afterEvaluate { // Grab all build types and product flavors def buildTypes = android.buildTypes.collect { type -> type.name } def productFlavors = android.productFlavors.collect { flavor -> flavor.name } println(buildTypes) println(productFlavors) // When no product flavors defined, use empty if (!productFlavors) productFlavors.add('') productFlavors.each { productFlavorName -> buildTypes.each { buildTypeName -> def sourceName, sourcePath if (!productFlavorName) { sourceName = sourcePath = "${buildTypeName}" } else { sourceName = "${productFlavorName}${buildTypeName.capitalize()}" sourcePath = "${productFlavorName}/${buildTypeName}" } def testTaskName = "test${sourceName.capitalize()}UnitTest" println("SourceName:${sourceName}") println("SourcePath:${sourcePath}") println("testTaskName:${testTaskName}") // Create coviewage task of form 'testFlavorTypeCoviewage' depending on 'testFlavorTypeUnitTest' task "${testTaskName}Coviewage" (type:JacocoReport, dependsOn: "$testTaskName") { group = "Reporting" description = "Generate Jacoco coviewage reports on the ${sourceName.capitalize()} build." classDirectories = fileTree( dir: "${project.buildDir}/intermediates/classs/${sourcePath}", excludes: ['**/R.class', '**/R$*.class', '**/*$ViewInjector*.*', '**/*$ViewBinder*.*', '**/BuildConfig.*', '**/Manifest*.*'] ) def coviewageSourceDirs = [ "src/main/java", "src/$productFlavorName/java", "src/$buildTypeName/java" ] additionalSourceDirs = files(coviewageSourceDirs) sourceDirectories = files(coviewageSourceDirs) executionData = files("${project.buildDir}/jacoco/${testTaskName}.exec") println("${project.buildDir}/jacoco/${testTaskName}.exec") reports { xml.enabled = true html.enabled = true } } } } } } apply plugin: 'jacoco' jacoco { toolVersion = "0.7.6.201602180812" } android { testOptions { unitTests.all { jacoco { includeNoLocationClasses = true } } } } project.afterEvaluate { // Grab all build types and product flavors def buildTypes = android.buildTypes.collect { type -> type.name } def productFlavors = android.productFlavors.collect { flavor -> flavor.name } println(buildTypes) println(productFlavors) // When no product flavors defined, use empty if (!productFlavors) productFlavors.add('') productFlavors.each { productFlavorName -> buildTypes.each { buildTypeName -> def sourceName, sourcePath if (!productFlavorName) { sourceName = sourcePath = "${buildTypeName}" } else { sourceName = "${productFlavorName}${buildTypeName.capitalize()}" sourcePath = "${productFlavorName}/${buildTypeName}" } def testTaskName = "test${sourceName.capitalize()}UnitTest" println("SourceName:${sourceName}") println("SourcePath:${sourcePath}") println("testTaskName:${testTaskName}") // Create coviewage task of form 'testFlavorTypeCoviewage' depending on 'testFlavorTypeUnitTest' task "${testTaskName}Coviewage" (type:JacocoReport, dependsOn: "$testTaskName") { group = "Reporting" description = "Generate Jacoco coviewage reports on the ${sourceName.capitalize()} build." classDirectories = fileTree( dir: "${project.buildDir}/intermediates/classs/${sourcePath}", excludes: ['**/R.class', '**/R$*.class', '**/*$ViewInjector*.*', '**/*$ViewBinder*.*', '**/BuildConfig.*', '**/Manifest*.*'] ) def coviewageSourceDirs = [ "src/main/java", "src/$productFlavorName/java", "src/$buildTypeName/java" ] additionalSourceDirs = files(coviewageSourceDirs) sourceDirectories = files(coviewageSourceDirs) executionData = files("${project.buildDir}/jacoco/${testTaskName}.exec") println("${project.buildDir}/jacoco/${testTaskName}.exec") reports { xml.enabled = true html.enabled = true } } } } } } apply plugin: 'jacoco' jacoco { toolVersion = "0.7.6.201602180812" } android { testOptions { unitTests.all { jacoco { includeNoLocationClasses = true } } } } project.afterEvaluate { // Grab all build types and product flavors def buildTypes = android.buildTypes.collect { type -> type.name } def productFlavors = android.productFlavors.collect { flavor -> flavor.name } println(buildTypes) println(productFlavors) // When no product flavors defined, use empty if (!productFlavors) productFlavors.add('') productFlavors.each { productFlavorName -> buildTypes.each { buildTypeName -> def sourceName, sourcePath if (!productFlavorName) { sourceName = sourcePath = "${buildTypeName}" } else { sourceName = "${productFlavorName}${buildTypeName.capitalize()}" sourcePath = "${productFlavorName}/${buildTypeName}" } def testTaskName = "test${sourceName.capitalize()}UnitTest" println("SourceName:${sourceName}") println("SourcePath:${sourcePath}") println("testTaskName:${testTaskName}") // Create coviewage task of form 'testFlavorTypeCoviewage' depending on 'testFlavorTypeUnitTest' task "${testTaskName}Coviewage" (type:JacocoReport, dependsOn: "$testTaskName") { group = "Reporting" description = "Generate Jacoco coviewage reports on the ${sourceName.capitalize()} build." classDirectories = fileTree( dir: "${project.buildDir}/intermediates/classs/${sourcePath}", excludes: ['**/R.class', '**/R$*.class', '**/*$ViewInjector*.*', '**/*$ViewBinder*.*', '**/BuildConfig.*', '**/Manifest*.*'] ) def coviewageSourceDirs = [ "src/main/java", "src/$productFlavorName/java", "src/$buildTypeName/java" ] additionalSourceDirs = files(coviewageSourceDirs) sourceDirectories = files(coviewageSourceDirs) executionData = files("${project.buildDir}/jacoco/${testTaskName}.exec") println("${project.buildDir}/jacoco/${testTaskName}.exec") reports { xml.enabled = true html.enabled = true } } } } } } apply plugin: 'jacoco' jacoco { toolVersion = "0.7.6.201602180812" } android { testOptions { unitTests.all { jacoco { includeNoLocationClasses = true } } } } project.afterEvaluate { // Grab all build types and product flavors def buildTypes = android.buildTypes.collect { type -> type.name } def productFlavors = android.productFlavors.collect { flavor -> flavor.name } println(buildTypes) println(productFlavors) // When no product flavors defined, use empty if (!productFlavors) productFlavors.add('') productFlavors.each { productFlavorName -> buildTypes.each { buildTypeName -> def sourceName, sourcePath if (!productFlavorName) { sourceName = sourcePath = "${buildTypeName}" } else { sourceName = "${productFlavorName}${buildTypeName.capitalize()}" sourcePath = "${productFlavorName}/${buildTypeName}" } def testTaskName = "test${sourceName.capitalize()}UnitTest" println("SourceName:${sourceName}") println("SourcePath:${sourcePath}") println("testTaskName:${testTaskName}") // Create coviewage task of form 'testFlavorTypeCoviewage' depending on 'testFlavorTypeUnitTest' task "${testTaskName}Coviewage" (type:JacocoReport, dependsOn: "$testTaskName") { group = "Reporting" description = "Generate Jacoco coviewage reports on the ${sourceName.capitalize()} build." classDirectories = fileTree( dir: "${project.buildDir}/intermediates/classs/${sourcePath}", excludes: ['**/R.class', '**/R$*.class', '**/*$ViewInjector*.*', '**/*$ViewBinder*.*', '**/BuildConfig.*', '**/Manifest*.*'] ) def coviewageSourceDirs = [ "src/main/java", "src/$productFlavorName/java", "src/$buildTypeName/java" ] additionalSourceDirs = files(coviewageSourceDirs) sourceDirectories = files(coviewageSourceDirs) executionData = files("${project.buildDir}/jacoco/${testTaskName}.exec") println("${project.buildDir}/jacoco/${testTaskName}.exec") reports { xml.enabled = true html.enabled = true } } } } } } apply plugin: 'jacoco' jacoco { toolVersion = "0.7.6.201602180812" } android { testOptions { unitTests.all { jacoco { includeNoLocationClasses = true } } } } project.afterEvaluate { // Grab all build types and product flavors def buildTypes = android.buildTypes.collect { type -> type.name } def productFlavors = android.productFlavors.collect { flavor -> flavor.name } println(buildTypes) println(productFlavors) // When no product flavors defined, use empty if (!productFlavors) productFlavors.add('') productFlavors.each { productFlavorName -> buildTypes.each { buildTypeName -> def sourceName, sourcePath if (!productFlavorName) { sourceName = sourcePath = "${buildTypeName}" } else { sourceName = "${productFlavorName}${buildTypeName.capitalize()}" sourcePath = "${productFlavorName}/${buildTypeName}" } def testTaskName = "test${sourceName.capitalize()}UnitTest" println("SourceName:${sourceName}") println("SourcePath:${sourcePath}") println("testTaskName:${testTaskName}") // Create coviewage task of form 'testFlavorTypeCoviewage' depending on 'testFlavorTypeUnitTest' task "${testTaskName}Coviewage" (type:JacocoReport, dependsOn: "$testTaskName") { group = "Reporting" description = "Generate Jacoco coviewage reports on the ${sourceName.capitalize()} build." classDirectories = fileTree( dir: "${project.buildDir}/intermediates/classs/${sourcePath}", excludes: ['**/R.class', '**/R$*.class', '**/*$ViewInjector*.*', '**/*$ViewBinder*.*', '**/BuildConfig.*', '**/Manifest*.*'] ) def coviewageSourceDirs = [ "src/main/java", "src/$productFlavorName/java", "src/$buildTypeName/java" ] additionalSourceDirs = files(coviewageSourceDirs) sourceDirectories = files(coviewageSourceDirs) executionData = files("${project.buildDir}/jacoco/${testTaskName}.exec") println("${project.buildDir}/jacoco/${testTaskName}.exec") reports { xml.enabled = true html.enabled = true } } } } } } apply plugin: 'jacoco' jacoco { toolVersion = "0.7.6.201602180812" } android { testOptions { unitTests.all { jacoco { includeNoLocationClasses = true } } } } project.afterEvaluate { // Grab all build types and product flavors def buildTypes = android.buildTypes.collect { type -> type.name } def productFlavors = android.productFlavors.collect { flavor -> flavor.name } println(buildTypes) println(productFlavors) // When no product flavors defined, use empty if (!productFlavors) productFlavors.add('') productFlavors.each { productFlavorName -> buildTypes.each { buildTypeName -> def sourceName, sourcePath if (!productFlavorName) { sourceName = sourcePath = "${buildTypeName}" } else { sourceName = "${productFlavorName}${buildTypeName.capitalize()}" sourcePath = "${productFlavorName}/${buildTypeName}" } def testTaskName = "test${sourceName.capitalize()}UnitTest" println("SourceName:${sourceName}") println("SourcePath:${sourcePath}") println("testTaskName:${testTaskName}") // Create coviewage task of form 'testFlavorTypeCoviewage' depending on 'testFlavorTypeUnitTest' task "${testTaskName}Coviewage" (type:JacocoReport, dependsOn: "$testTaskName") { group = "Reporting" description = "Generate Jacoco coviewage reports on the ${sourceName.capitalize()} build." classDirectories = fileTree( dir: "${project.buildDir}/intermediates/classs/${sourcePath}", excludes: ['**/R.class', '**/R$*.class', '**/*$ViewInjector*.*', '**/*$ViewBinder*.*', '**/BuildConfig.*', '**/Manifest*.*'] ) def coviewageSourceDirs = [ "src/main/java", "src/$productFlavorName/java", "src/$buildTypeName/java" ] additionalSourceDirs = files(coviewageSourceDirs) sourceDirectories = files(coviewageSourceDirs) executionData = files("${project.buildDir}/jacoco/${testTaskName}.exec") println("${project.buildDir}/jacoco/${testTaskName}.exec") reports { xml.enabled = true html.enabled = true } } } } } } apply plugin: 'jacoco' jacoco { toolVersion = "0.7.6.201602180812" } android { testOptions { unitTests.all { jacoco { includeNoLocationClasses = true } } } } project.afterEvaluate { // Grab all build types and product flavors def buildTypes = android.buildTypes.collect { type -> type.name } def productFlavors = android.productFlavors.collect { flavor -> flavor.name } println(buildTypes) println(productFlavors) // When no product flavors defined, use empty if (!productFlavors) productFlavors.add('') productFlavors.each { productFlavorName -> buildTypes.each { buildTypeName -> def sourceName, sourcePath if (!productFlavorName) { sourceName = sourcePath = "${buildTypeName}" } else { sourceName = "${productFlavorName}${buildTypeName.capitalize()}" sourcePath = "${productFlavorName}/${buildTypeName}" } def testTaskName = "test${sourceName.capitalize()}UnitTest" println("SourceName:${sourceName}") println("SourcePath:${sourcePath}") println("testTaskName:${testTaskName}") // Create coviewage task of form 'testFlavorTypeCoviewage' depending on 'testFlavorTypeUnitTest' task "${testTaskName}Coviewage" (type:JacocoReport, dependsOn: "$testTaskName") { group = "Reporting" description = "Generate Jacoco coviewage reports on the ${sourceName.capitalize()} build." classDirectories = fileTree( dir: "${project.buildDir}/intermediates/classs/${sourcePath}", excludes: ['**/R.class', '**/R$*.class', '**/*$ViewInjector*.*', '**/*$ViewBinder*.*', '**/BuildConfig.*', '**/Manifest*.*'] ) def coviewageSourceDirs = [ "src/main/java", "src/$productFlavorName/java", "src/$buildTypeName/java" ] additionalSourceDirs = files(coviewageSourceDirs) sourceDirectories = files(coviewageSourceDirs) executionData = files("${project.buildDir}/jacoco/${testTaskName}.exec") println("${project.buildDir}/jacoco/${testTaskName}.exec") reports { xml.enabled = true html.enabled = true } } } } } ) apply plugin: 'jacoco' jacoco { toolVersion = "0.7.6.201602180812" } android { testOptions { unitTests.all { jacoco { includeNoLocationClasses = true } } } } project.afterEvaluate { // Grab all build types and product flavors def buildTypes = android.buildTypes.collect { type -> type.name } def productFlavors = android.productFlavors.collect { flavor -> flavor.name } println(buildTypes) println(productFlavors) // When no product flavors defined, use empty if (!productFlavors) productFlavors.add('') productFlavors.each { productFlavorName -> buildTypes.each { buildTypeName -> def sourceName, sourcePath if (!productFlavorName) { sourceName = sourcePath = "${buildTypeName}" } else { sourceName = "${productFlavorName}${buildTypeName.capitalize()}" sourcePath = "${productFlavorName}/${buildTypeName}" } def testTaskName = "test${sourceName.capitalize()}UnitTest" println("SourceName:${sourceName}") println("SourcePath:${sourcePath}") println("testTaskName:${testTaskName}") // Create coviewage task of form 'testFlavorTypeCoviewage' depending on 'testFlavorTypeUnitTest' task "${testTaskName}Coviewage" (type:JacocoReport, dependsOn: "$testTaskName") { group = "Reporting" description = "Generate Jacoco coviewage reports on the ${sourceName.capitalize()} build." classDirectories = fileTree( dir: "${project.buildDir}/intermediates/classs/${sourcePath}", excludes: ['**/R.class', '**/R$*.class', '**/*$ViewInjector*.*', '**/*$ViewBinder*.*', '**/BuildConfig.*', '**/Manifest*.*'] ) def coviewageSourceDirs = [ "src/main/java", "src/$productFlavorName/java", "src/$buildTypeName/java" ] additionalSourceDirs = files(coviewageSourceDirs) sourceDirectories = files(coviewageSourceDirs) executionData = files("${project.buildDir}/jacoco/${testTaskName}.exec") println("${project.buildDir}/jacoco/${testTaskName}.exec") reports { xml.enabled = true html.enabled = true } } } } } ] apply plugin: 'jacoco' jacoco { toolVersion = "0.7.6.201602180812" } android { testOptions { unitTests.all { jacoco { includeNoLocationClasses = true } } } } project.afterEvaluate { // Grab all build types and product flavors def buildTypes = android.buildTypes.collect { type -> type.name } def productFlavors = android.productFlavors.collect { flavor -> flavor.name } println(buildTypes) println(productFlavors) // When no product flavors defined, use empty if (!productFlavors) productFlavors.add('') productFlavors.each { productFlavorName -> buildTypes.each { buildTypeName -> def sourceName, sourcePath if (!productFlavorName) { sourceName = sourcePath = "${buildTypeName}" } else { sourceName = "${productFlavorName}${buildTypeName.capitalize()}" sourcePath = "${productFlavorName}/${buildTypeName}" } def testTaskName = "test${sourceName.capitalize()}UnitTest" println("SourceName:${sourceName}") println("SourcePath:${sourcePath}") println("testTaskName:${testTaskName}") // Create coviewage task of form 'testFlavorTypeCoviewage' depending on 'testFlavorTypeUnitTest' task "${testTaskName}Coviewage" (type:JacocoReport, dependsOn: "$testTaskName") { group = "Reporting" description = "Generate Jacoco coviewage reports on the ${sourceName.capitalize()} build." classDirectories = fileTree( dir: "${project.buildDir}/intermediates/classs/${sourcePath}", excludes: ['**/R.class', '**/R$*.class', '**/*$ViewInjector*.*', '**/*$ViewBinder*.*', '**/BuildConfig.*', '**/Manifest*.*'] ) def coviewageSourceDirs = [ "src/main/java", "src/$productFlavorName/java", "src/$buildTypeName/java" ] additionalSourceDirs = files(coviewageSourceDirs) sourceDirectories = files(coviewageSourceDirs) executionData = files("${project.buildDir}/jacoco/${testTaskName}.exec") println("${project.buildDir}/jacoco/${testTaskName}.exec") reports { xml.enabled = true html.enabled = true } } } } } } apply plugin: 'jacoco' jacoco { toolVersion = "0.7.6.201602180812" } android { testOptions { unitTests.all { jacoco { includeNoLocationClasses = true } } } } project.afterEvaluate { // Grab all build types and product flavors def buildTypes = android.buildTypes.collect { type -> type.name } def productFlavors = android.productFlavors.collect { flavor -> flavor.name } println(buildTypes) println(productFlavors) // When no product flavors defined, use empty if (!productFlavors) productFlavors.add('') productFlavors.each { productFlavorName -> buildTypes.each { buildTypeName -> def sourceName, sourcePath if (!productFlavorName) { sourceName = sourcePath = "${buildTypeName}" } else { sourceName = "${productFlavorName}${buildTypeName.capitalize()}" sourcePath = "${productFlavorName}/${buildTypeName}" } def testTaskName = "test${sourceName.capitalize()}UnitTest" println("SourceName:${sourceName}") println("SourcePath:${sourcePath}") println("testTaskName:${testTaskName}") // Create coviewage task of form 'testFlavorTypeCoviewage' depending on 'testFlavorTypeUnitTest' task "${testTaskName}Coviewage" (type:JacocoReport, dependsOn: "$testTaskName") { group = "Reporting" description = "Generate Jacoco coviewage reports on the ${sourceName.capitalize()} build." classDirectories = fileTree( dir: "${project.buildDir}/intermediates/classs/${sourcePath}", excludes: ['**/R.class', '**/R$*.class', '**/*$ViewInjector*.*', '**/*$ViewBinder*.*', '**/BuildConfig.*', '**/Manifest*.*'] ) def coviewageSourceDirs = [ "src/main/java", "src/$productFlavorName/java", "src/$buildTypeName/java" ] additionalSourceDirs = files(coviewageSourceDirs) sourceDirectories = files(coviewageSourceDirs) executionData = files("${project.buildDir}/jacoco/${testTaskName}.exec") println("${project.buildDir}/jacoco/${testTaskName}.exec") reports { xml.enabled = true html.enabled = true } } } } } } apply plugin: 'jacoco' jacoco { toolVersion = "0.7.6.201602180812" } android { testOptions { unitTests.all { jacoco { includeNoLocationClasses = true } } } } project.afterEvaluate { // Grab all build types and product flavors def buildTypes = android.buildTypes.collect { type -> type.name } def productFlavors = android.productFlavors.collect { flavor -> flavor.name } println(buildTypes) println(productFlavors) // When no product flavors defined, use empty if (!productFlavors) productFlavors.add('') productFlavors.each { productFlavorName -> buildTypes.each { buildTypeName -> def sourceName, sourcePath if (!productFlavorName) { sourceName = sourcePath = "${buildTypeName}" } else { sourceName = "${productFlavorName}${buildTypeName.capitalize()}" sourcePath = "${productFlavorName}/${buildTypeName}" } def testTaskName = "test${sourceName.capitalize()}UnitTest" println("SourceName:${sourceName}") println("SourcePath:${sourcePath}") println("testTaskName:${testTaskName}") // Create coviewage task of form 'testFlavorTypeCoviewage' depending on 'testFlavorTypeUnitTest' task "${testTaskName}Coviewage" (type:JacocoReport, dependsOn: "$testTaskName") { group = "Reporting" description = "Generate Jacoco coviewage reports on the ${sourceName.capitalize()} build." classDirectories = fileTree( dir: "${project.buildDir}/intermediates/classs/${sourcePath}", excludes: ['**/R.class', '**/R$*.class', '**/*$ViewInjector*.*', '**/*$ViewBinder*.*', '**/BuildConfig.*', '**/Manifest*.*'] ) def coviewageSourceDirs = [ "src/main/java", "src/$productFlavorName/java", "src/$buildTypeName/java" ] additionalSourceDirs = files(coviewageSourceDirs) sourceDirectories = files(coviewageSourceDirs) executionData = files("${project.buildDir}/jacoco/${testTaskName}.exec") println("${project.buildDir}/jacoco/${testTaskName}.exec") reports { xml.enabled = true html.enabled = true } } } } } } apply plugin: 'jacoco' jacoco { toolVersion = "0.7.6.201602180812" } android { testOptions { unitTests.all { jacoco { includeNoLocationClasses = true } } } } project.afterEvaluate { // Grab all build types and product flavors def buildTypes = android.buildTypes.collect { type -> type.name } def productFlavors = android.productFlavors.collect { flavor -> flavor.name } println(buildTypes) println(productFlavors) // When no product flavors defined, use empty if (!productFlavors) productFlavors.add('') productFlavors.each { productFlavorName -> buildTypes.each { buildTypeName -> def sourceName, sourcePath if (!productFlavorName) { sourceName = sourcePath = "${buildTypeName}" } else { sourceName = "${productFlavorName}${buildTypeName.capitalize()}" sourcePath = "${productFlavorName}/${buildTypeName}" } def testTaskName = "test${sourceName.capitalize()}UnitTest" println("SourceName:${sourceName}") println("SourcePath:${sourcePath}") println("testTaskName:${testTaskName}") // Create coviewage task of form 'testFlavorTypeCoviewage' depending on 'testFlavorTypeUnitTest' task "${testTaskName}Coviewage" (type:JacocoReport, dependsOn: "$testTaskName") { group = "Reporting" description = "Generate Jacoco coviewage reports on the ${sourceName.capitalize()} build." classDirectories = fileTree( dir: "${project.buildDir}/intermediates/classs/${sourcePath}", excludes: ['**/R.class', '**/R$*.class', '**/*$ViewInjector*.*', '**/*$ViewBinder*.*', '**/BuildConfig.*', '**/Manifest*.*'] ) def coviewageSourceDirs = [ "src/main/java", "src/$productFlavorName/java", "src/$buildTypeName/java" ] additionalSourceDirs = files(coviewageSourceDirs) sourceDirectories = files(coviewageSourceDirs) executionData = files("${project.buildDir}/jacoco/${testTaskName}.exec") println("${project.buildDir}/jacoco/${testTaskName}.exec") reports { xml.enabled = true html.enabled = true } } } } } } apply plugin: 'jacoco' jacoco { toolVersion = "0.7.6.201602180812" } android { testOptions { unitTests.all { jacoco { includeNoLocationClasses = true } } } } project.afterEvaluate { // Grab all build types and product flavors def buildTypes = android.buildTypes.collect { type -> type.name } def productFlavors = android.productFlavors.collect { flavor -> flavor.name } println(buildTypes) println(productFlavors) // When no product flavors defined, use empty if (!productFlavors) productFlavors.add('') productFlavors.each { productFlavorName -> buildTypes.each { buildTypeName -> def sourceName, sourcePath if (!productFlavorName) { sourceName = sourcePath = "${buildTypeName}" } else { sourceName = "${productFlavorName}${buildTypeName.capitalize()}" sourcePath = "${productFlavorName}/${buildTypeName}" } def testTaskName = "test${sourceName.capitalize()}UnitTest" println("SourceName:${sourceName}") println("SourcePath:${sourcePath}") println("testTaskName:${testTaskName}") // Create coviewage task of form 'testFlavorTypeCoviewage' depending on 'testFlavorTypeUnitTest' task "${testTaskName}Coviewage" (type:JacocoReport, dependsOn: "$testTaskName") { group = "Reporting" description = "Generate Jacoco coviewage reports on the ${sourceName.capitalize()} build." classDirectories = fileTree( dir: "${project.buildDir}/intermediates/classs/${sourcePath}", excludes: ['**/R.class', '**/R$*.class', '**/*$ViewInjector*.*', '**/*$ViewBinder*.*', '**/BuildConfig.*', '**/Manifest*.*'] ) def coviewageSourceDirs = [ "src/main/java", "src/$productFlavorName/java", "src/$buildTypeName/java" ] additionalSourceDirs = files(coviewageSourceDirs) sourceDirectories = files(coviewageSourceDirs) executionData = files("${project.buildDir}/jacoco/${testTaskName}.exec") println("${project.buildDir}/jacoco/${testTaskName}.exec") reports { xml.enabled = true html.enabled = true } } } } } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.