can anyone help me to resolve this issue
# compose
n
can anyone help me to resolve this issue
m
Did you attached
--info
to look what is going on?
n
Copy code
jacoco {
    toolVersion = '0.8.6'
}
Copy code
"com.android.tools.build:gradle:7.0.0"
is there any issue with above version and compose
m
Not that I know of...but you can try the latest which is 0.8.7.
n
okay let me check with that
m
However maybe try to run your coverage task with the
--info
flag to see what is actually going on...it looks more like the the exec files are missing.
n
Task uilibrarycreateDebugAndroidTestCoverageReport FAILED
Watching 448 directories to track changes Caching disabled for task 'uilibrarycreateDebugAndroidTestCoverageReport' because: Caching has not been enabled for the task Task 'uilibrarycreateDebugAndroidTestCoverageReport' is not up-to-date because: Task has failed previously. Watching 445 directories to track changes file or directory '/home/i-exceed.com/napa.ram/AndroidStudioProjects/iexceed/platform/ui-library-android/uilibrary/build/generated/aidl_source_output_dir/debug/out', not found file or directory '/home/i-exceed.com/napa.ram/AndroidStudioProjects/iexceed/platform/ui-library-android/uilibrary/build/generated/renderscript_source_output_dir/debug/out', not found Watching 468 directories to track changes uilibrarycreateDebugAndroidTestCoverageReport (Thread[Execution worker for ':' Thread 2,5,main]) completed. Took 0.398 secs. Execution failed for task 'uilibrarycreateDebugAndroidTestCoverageReport'.
A failure occurred while executing com.android.build.gradle.internal.coverage.JacocoReportTask$JacocoReportWorkerAction
> Unable to generate Jacoco report * Try: Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.
m
Do you have in the build directory a folder
jacoco
which contain *.exec files?
n
no
m
Are you using instrumented tests for Android?
n
yes
m
Ah...okay...do you have something like
isIncludeNoLocationClasses = true
added in your Android Config block?
n
yes sharing build. gradle file
m
also
isTestCoverageEnabled = true
n
Copy code
tasks.withType(Test) {
    jacoco.includeNoLocationClasses = true
    jacoco.excludes = ['jdk.internal.*']
}
Copy code
debug {
    debuggable true
    minifyEnabled false
    proguardFiles getDefaultProguardFile('proguard-android.txt'), '<http://proguard-rules.pro|proguard-rules.pro>'
    testCoverageEnabled true
}
m
Which files is jacoco consuming for
executionData
? something like
***/**exec.
or
***/**.ec
?
n
Copy code
jacoco {
    toolVersion = '0.8.6'
}

tasks.withType(Test) {
    jacoco.includeNoLocationClasses = true
    jacoco.excludes = ['jdk.internal.*']
}

task jacocoTestReport(type: JacocoReport,
        dependsOn: ['createDebugCoverageReport', 'testDebugUnitTest']) {

    reports {
        xml.enabled = true
        html.enabled = true
        csv.enabled = true
    }

    def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*',
                      '**/*Test*.*', '**/*debug', '**/*databinding','android/**/*.*', '**/Glide*.*', '**/Rave*.*', '**/*Validator.*','**/*$ViewInjector*.*']
    def debugTree = fileTree(
            // Java generated classes on Android project (debug build)
            dir: "$buildDir/intermediates/javac/debug",
            excludes: fileFilter
    ) + fileTree(
            // Kotlin generated classes on Android project (debug build)
            dir: "$buildDir/tmp/kotlin-classes/debug",
            excludes: fileFilter
    ) + fileTree(dir: "${buildDir}/intermediates/classes/debug", excludes: fileFilter)
    def mainSrc = "$project.projectDir/src/main/java"

    sourceDirectories.from = files([mainSrc])
    classDirectories.from = files([debugTree])
    additionalSourceDirs.from = files([
            "${buildDir}/generated/source/buildConfig/debug",
            "${buildDir}/generated/source/rs/debug"
    ])

    executionData.from = fileTree(dir: project.buildDir, includes: [
            'outputs/code_coverage/debugAndroidTest/connected/*<http://coverage.ec|coverage.ec>', 'jacoco/testDebugUnitTest.exec'
    ])
}
m
Can you check your build folder if
outputs/code_coverage
is still valid? I am not sure if this changed with AGP 7.0.x
I also think
Copy code
tasks.withType(Test) {
    jacoco.includeNoLocationClasses = true
    jacoco.excludes = ['jdk.internal.*']
}
needs to be done directly in the Android config...