Kotlin / Kotlin/binary-compatibility-validator
BCV tasks not registered for Android libraries when using AGP 9.x (built-in Kotlin)
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 965
- Forks
- 68
- Avg merge
- 22h 36m
- Merged PRs (30d)
- 1
Description
Description
Starting with AGP 9.0, the Android Gradle Plugin provides built-in Kotlin compilation support and no longer requires (and actively blocks) the org.jetbrains.kotlin.android plugin. This means BCV's Android task registration never fires, since it hooks into the kotlin-android plugin ID:
private fun configureAndroidPluginForKotlinLibrary(
project: Project,
extension: ApiValidationExtension,
jvmRuntimeClasspath: NamedDomainObjectProvider<Configuration>
) = configurePlugin("kotlin-android", project, extension) {
// ...
}
As a result, apiDump and apiCheck tasks are never created for any Android library module when using AGP 9.x. The check task also does not include any BCV validation.
The migration path is also blocked
The BCV README recommends migrating to the built-in ABI validation in the Kotlin Gradle plugin (kotlin { abiValidation { ... } }). However, this is also not possible with AGP 9.x because:
- KGP's
abiValidationDSL is only available on theKotlinAndroidProjectExtensionregistered by thekotlin-androidplugin. - AGP 9.x blocks applying
kotlin-androidwith the error:The 'org.jetbrains.kotlin.android' plugin is no longer required for Kotlin support since AGP 9.0.
- The
kotlin {}extension registered by AGP 9.x does not include theabiValidationDSL.
This creates a gap where neither the standalone BCV plugin nor the KGP built-in replacement can provide API validation for Android library projects using AGP 9.x.
Environment
- AGP: 9.0.1
- Kotlin: 2.2.21
- BCV: 0.18.1
- Gradle: 9.3.1
Steps to reproduce
- Create an Android library project using AGP 9.x (no
kotlin-androidplugin applied — AGP handles Kotlin natively). - Apply
org.jetbrains.kotlinx.binary-compatibility-validatorversion 0.18.1. - Run
./gradlew apiDumpor./gradlew apiCheck. - Observe:
Task 'apiDump' not found.
Expected behavior
BCV should detect Android library modules using AGP 9.x's built-in Kotlin and register apiDump/apiCheck tasks for them, or the KGP built-in abiValidation should be usable alongside AGP 9.x.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with configureAndroidPluginForKotlinLibrary in src/main/kotlin/BinaryCompatibilityValidatorPlugin.kt around line 131, then reproduce the issue with AGP 9.0.1, Kotlin 2.2.21, BCV 0.18.1, and Gradle 9.3.1. Done means Android library projects using AGP 9.x expose apiDump and apiCheck tasks and include BCV validation in check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- build-system, mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100