Skip to content

Using modules without instrumented tests on gradle managed devices #117

@ptielsch

Description

@ptielsch

Firstly, I want to thank you for this great library! It saved me a ton of time since moving away from manual jacoco setup and works really well :)

I have a project with multiple modules which only have unit tests, and only the :app module has instrumented tests. Ive also broken it down into a minimal test project to make sure its not a side effect. Im currently using Gradle 8.10.2.

The build.gradle of those modules contain:

buildTypes {
        debug {
            enableUnitTestCoverage = true
            enableAndroidTestCoverage = false
        }
    }

When running them with runOnGradleManagedDevices = false on a physical device, it works like a charm.

However, when running them on a gradle managed device, the following is thrown:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':rootCoverageReport'.
> Task with path 'sandboxLibrary:va5api35DebugAndroidTest' not found in root project 'Sandbox'.

Ive found that registering an empty gradle task in the affected libraries is a valid workaround and reports are generated.

tasks.register("va5api35DebugAndroidTest"){
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions