Skip to content

AGP 9.0.0: Variant-specific report tasks not generated, koverXmlReport has no test task dependencies #785

@shreknitin89

Description

@shreknitin89

Describe the bug

With Android Gradle Plugin 9.0.0, Kover does not generate variant-specific report tasks (e.g., koverXmlReportGoogleplayPremiumDebug). Additionally, the total koverXmlReport task has no dependencies on test tasks, meaning running it independently produces an empty coverage report.

Expected behavior

According to the Kover documentation:

For each Gradle Build Variant, Kover creates its own report variant that have the same names.

And:

Running one of these tasks automatically triggers the launch of all test tasks for debug build variant

Expected:

  • Variant-specific tasks like koverXmlReportVariantDebug should exist
  • koverXmlReportGoogleplayPremiumDebug should depend on testVariantDebugUnitTest
  • koverXmlReport (total) should depend on all test tasks

Actual behavior

With AGP 9.0.0:

  • Variant-specific report tasks do NOT exist
  • koverXmlReport has NO test task dependencies
  • Running koverXmlReport independently produces an empty report (0% coverage)

Verification:

# Check dependencies of koverXmlReport
./gradlew :Scribd:koverXmlReport --dry-run

# Output shows only:
:Scribd:koverGenerateArtifact SKIPPED
:Scribd:koverXmlReport SKIPPED

# No test tasks are included as dependencies

Empty report generated:

<?xml version="1.0" ?>
<report name="Kover Gradle Plugin XML report for :android">
<counter type="INSTRUCTION" missed="0" covered="0"/>
<counter type="BRANCH" missed="0" covered="0"/>
<counter type="LINE" missed="0" covered="0"/>
<counter type="METHOD" missed="0" covered="0"/>
<counter type="CLASS" missed="0" covered="0"/>
</report>

Comparison with AGP 8.x (main branch):

On AGP 8.x, the variant-specific task correctly depends on test tasks:

./gradlew :Scribd:koverXmlReportVariantDebug --dry-run
# Output includes:
:Scribd:testVariantDebugUnitTest SKIPPED

Workaround

Explicitly run the test task before generating the report:

./gradlew :Scribd:testVariantDebugUnitTest :Scribd:koverXmlReport

This works because Kover's agent still instruments code and collects coverage during test execution; the report task then uses this collected data.

Environment

  • Kover Gradle Plugin version: 0.9.4
  • Gradle version: 9.3.0
  • Android Gradle Plugin version: 9.0.0
  • Kotlin version: 2.3.0
  • Kotlin project type: Android Application with multiple product flavors and build types
  • Coverage Toolset: Kover (default)

Additional context

This may be related to #784 (AGP 9.0.0 changes on Variant API), but that issue describes a different symptom (custom variant creation with add() not working). This issue is specifically about:

  1. Variant-specific report tasks not being generated at all
  2. The total report task missing test task dependencies

Metadata

Metadata

Assignees

Labels

BugBug issue typeS: ready for releaseStatus: merged in the main branch

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions