-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jacoco Coverage report generated via Android gradle is empty #183
Comments
Hey Aditya, I am also facing the same issue, if you got anything please let me know! Anyone, please suggest some solutions to the above issues. Thanks, |
Is this still an issue? I know that every now and then when there's a new version, build directories are moved and need to be updated here. |
Yes it looks like, I have a similar issue since I upgraded to android studio 4.2 (gradle plugin 4.2.0 and gradle 6.7.1) apparently. |
After upgrading my plugin version to 0.8.7 I had the same problem and I found out that the flag |
@mfd03 looks like you are right. I upgraded jacoco to 0.8.7 and set testCoverageEnbaled to false and it works again with gradle plugin 4.2.0 |
Hello all, Below are the steps I tired: After that I am getting coverage report is zero. |
I am also having this issue setting |
- A bug as reported on a relative repository vanniktech/gradle-android-junit-jacoco-plugin#183 prevents jacoco exec coverage file from being generated when android.buildTypes.debug.testCoverageEnabled is true - Disabled the createDebugCoverageReport from the jacocoTestReport therefore disabling running of instrumentation tests
- A bug as reported on a relative repository vanniktech/gradle-android-junit-jacoco-plugin#183 prevents jacoco exec coverage file from being generated when android.buildTypes.debug.testCoverageEnabled is true - Disabled the createDebugCoverageReport from the jacocoTestReport therefore disabling running of instrumentation tests
- A bug as reported on a relative repository vanniktech/gradle-android-junit-jacoco-plugin#183 prevents jacoco exec coverage file from being generated when android.buildTypes.debug.testCoverageEnabled is true - Disabled the createDebugCoverageReport from the jacocoTestReport therefore disabling running of instrumentation tests
- A bug as reported on a relative repository vanniktech/gradle-android-junit-jacoco-plugin#183 prevents jacoco exec coverage file from being generated when android.buildTypes.debug.testCoverageEnabled is true - Disabled the createDebugCoverageReport from the jacocoTestReport therefore disabling running of instrumentation tests
Dear Team,
I want to implement Jacoco in my Android Studio (gradle v 3.5). Done all the changes required in both gradles. The jacoco report is getting generated but no coverage is there. Tried almost all commands.
Also, I am trying to generate this for my Local Unit test cases (not android tests).
Here I am attaching my both gradle files.
Please assist me on this as I am stuck from last one month.
Regards,
Aditya A
App Gradle
apply plugin: 'com.android.application'
apply plugin : 'jacoco'
android {
compileSdkVersion 30
buildToolsVersion "30.0.1"
defaultConfig {
applicationId "com.example.myfrstapp"
minSdkVersion 15
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
testCoverageEnabled false
}
debug{
testCoverageEnabled true
}
}
testOptions {
unitTests.all {
jacoco {
includeNoLocationClasses = true
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
testImplementation 'junit:junit:4.13'
testImplementation 'org.mockito:mockito-core:1.10.19'
testImplementation 'org.powermock:powermock-core:1.7.0RC2'
testImplementation 'org.powermock:powermock-module-junit4:1.7.0RC2'
testImplementation 'org.powermock:powermock-api-mockito2:1.7.0RC2'
//testImplemetation 'org.robolectric:robolectric:2.3'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
task jacocoTestReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') {
group="Reporting"
description="Generate Jacoco coverage Report"
reports {
xml.enabled = true
html.enabled = true
}
////
def fileFilter = ['/R*.class',
'/$InjectAdapter.class',
'**/$ModuleAdapter.class',
'/$ViewInjector.class',
'androidTest//.']
}
Project Gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
// maven {
// url "https://maven.google.com/"
// }
maven {
url "https://plugins.gradle.org/m2/"
}
jcenter()
}
}
jacoco {
applyTo run
}
task applicationCodeCoverageReport(type:JacocoReport) {
executionData run
sourceSets sourceSets.main
}
task codeCoverageReport(type: JacocoReport) {
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
}
task jacocoRootTestReport(type: JacocoReport) {
}
codeCoverageReport.dependsOn {
subprojects*.test
}
The text was updated successfully, but these errors were encountered: