Skip to content

IDE Sync failure for AGP 9 #776

@jonapoul

Description

@jonapoul

Describe the bug
When loading Kover 0.9.3 with a multiplatform library project using the Android gradle plugin (AGP) v9 prerelease candidates, I get a sync failure. Because this is AGP9, this is using the new Android KMP plugin instead of com.android.library.

I've tried with a few of the AGP9 alphas/beta releases, the break in sync success/failure comes between 9.0.0-alpha13 and 9.0.0-alpha14. Anything after is broken, anything before is fine.

Errors

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'kover-bug'.
> Kover error: Kover requires extension with name 'android' for project ':' since it is recognized as Kotlin/Android project
  Please create an issue in Kover Gradle Plugin repository: https://github.com/Kotlin/kotlinx-kover/issues

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to generate a Build Scan (powered by Develocity).
> Get more help at https://help.gradle.org.

then

Caused by: kotlinx.kover.gradle.plugin.commons.KoverCriticalException: Kover error: Kover requires extension with name 'android' for project ':' since it is recognized as Kotlin/Android project
Please create an issue in Kover Gradle Plugin repository: https://github.com/Kotlin/kotlinx-kover/issues
	at kotlinx.kover.gradle.plugin.locators.KotlinMultiPlatformLocatorKt.locateAndroidVariants(KotlinMultiPlatformLocator.kt:49)
	at kotlinx.kover.gradle.plugin.locators.KotlinMultiPlatformLocatorKt.locateKotlinMultiplatformVariants(KotlinMultiPlatformLocator.kt:37)
	at kotlinx.kover.gradle.plugin.locators.ProvidedVariantsLocator.finalize(ProvidedVariantsLocator.kt:96)
	at kotlinx.kover.gradle.plugin.locators.ProvidedVariantsLocator.access$finalize(ProvidedVariantsLocator.kt:13)
	at kotlinx.kover.gradle.plugin.locators.ProvidedVariantsLocator$scheduleDequeue$1.execute(ProvidedVariantsLocator.kt:83)
	at kotlinx.kover.gradle.plugin.locators.ProvidedVariantsLocator$scheduleDequeue$1.execute(ProvidedVariantsLocator.kt:76)

Expected behavior
IDE to successfully sync with KMP, AGP and Kover applied together.

Reproducer
See attached zip for a minimal reproducer: koverbug.zip. The sample is a single-project build, but the same behaviour shows up in multi module too.

Reports
See above

Environment

  • Kover Gradle Plugin version: 0.9.3
  • Gradle version: 9.2.1
  • Kotlin project type: KMP
  • Coverage Toolset (if customized in build script): Not configured
  • Other context important for this bug: Running on Linux

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions