<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Tomi Jokinen on Medium]]></title>
        <description><![CDATA[Stories by Tomi Jokinen on Medium]]></description>
        <link>https://medium.com/@tjokinen?source=rss-2953e6db737e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*qIfUGqnay2dUPuKejRgxJA.jpeg</url>
            <title>Stories by Tomi Jokinen on Medium</title>
            <link>https://medium.com/@tjokinen?source=rss-2953e6db737e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 12:01:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tjokinen/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Binary Compatibility Validation Silently Stops Working on AGP 9’s Built-in Kotlin]]></title>
            <link>https://medium.com/@tjokinen/binary-compatibility-validation-silently-stops-working-on-agp-9s-built-in-kotlin-974162978780?source=rss-2953e6db737e------2</link>
            <guid isPermaLink="false">https://medium.com/p/974162978780</guid>
            <category><![CDATA[android-gradle-plugin]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[kotlin-libraries]]></category>
            <category><![CDATA[android-libraries]]></category>
            <category><![CDATA[android-development]]></category>
            <dc:creator><![CDATA[Tomi Jokinen]]></dc:creator>
            <pubDate>Tue, 07 Jul 2026 05:31:59 GMT</pubDate>
            <atom:updated>2026-07-09T04:05:19.243Z</atom:updated>
            <content:encoded><![CDATA[<p><em>apiDump is gone, abiValidation won’t resolve, and Dokka produces empty output. Where the tasks went, how I traced it, and the small plugin that brings the checks back.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8BmsU40t-2p01X5Z" /><figcaption>Photo by <a href="https://unsplash.com/@rubaitulazad?utm_source=medium&amp;utm_medium=referral">Rubaitul Azad</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If you maintain an Android library and you’ve upgraded to Android Gradle Plugin 9, try this:</p><pre>$ ./gradlew apiDump<br>Task &#39;apiDump&#39; not found in root project.</pre><p>There’s no warning during configuration and no deprecation notice. The <a href="https://github.com/Kotlin/binary-compatibility-validator">Kotlin Binary Compatibility Validator</a> (BCV) plugin applies cleanly and then does nothing at all. If your CI runs <em>check</em>, the API verification it used to include is simply no longer there, and the build stays green.</p><p>I hit this while building <a href="https://github.com/tjokinen/blease">blease</a>, an Android BLE library, on AGP 9.2. This article is the investigation: what breaks, the evidence for why, what I couldn’t confirm, and the workaround I ended up packaging as a published Gradle plugin. Everything here was observed on AGP 9.2.0, Gradle 9.6.0, Kotlin 2.3.x and BCV 0.17.0 to 0.18.1. Other combinations may differ.</p><h4>Thirty seconds of background</h4><p>Binary compatibility is the shape of your public API as seen by already-compiled code. If an app was built against version 1.0 of your library and you rename a public function in 1.1, that app crashes at runtime even though your own code compiles fine. BCV protects against this: <em>apiDump</em> writes your public API into a committed <em>.api</em> text file, and <em>apiCheck</em> (wired into <em>check</em>) fails the build whenever the compiled API drifts from that file. Accidental breaking changes become a red build, and intentional ones become a reviewable diff. It’s the standard tool for this in the Kotlin world; kotlinx.coroutines and OkHttp both commit <em>.api</em> files.</p><p>The other ingredient is AGP 9’s headline change, built-in Kotlin. You no longer apply the standalone <em>org.jetbrains.kotlin.android</em> plugin next to <em>com.android.library</em>; AGP now compiles Kotlin itself. That’s one less plugin and one less version constraint to manage, so I opted in without hesitating.</p><p>That removed plugin turned out to be the cause of everything that follows.</p><h4>Three tools fail, in three different ways</h4><p>The binary compatibility validator was the loudest failure, or rather the quietest: the <em>apiDump</em> and <em>apiCheck</em> tasks are never created, with no diagnostic anywhere.</p><p>Kotlin’s newer built-in ABI validation, the intended successor to BCV, fails one step earlier. The documented configuration doesn’t even compile:</p><pre>kotlin {<br> abiValidation { enabled.set(true) }<br>}</pre><pre>e: Unresolved reference &#39;abiValidation&#39;.</pre><p>And Dokka, the API documentation generator, produced the most dangerous failure of the three: <em>dokkaGenerate</em> reported <em>BUILD SUCCESSFUL</em> and wrote an empty documentation site. Nothing about a successful build prompts you to go and check what it actually produced.</p><p>All three symptoms trace back to the same cause.</p><h4>Following the evidence</h4><p>My first explanation was really just a guess, so I made myself verify each step. Two of them can be checked from primary sources.</p><p>First, how does BCV decide whether to create its tasks? Its <a href="https://github.com/Kotlin/binary-compatibility-validator/blob/master/src/main/kotlin/BinaryCompatibilityValidatorPlugin.kt">plugin source</a><br>answers directly. Task registration is gated behind plugin detection:</p><pre>private fun configurePlugin(name: String, project: Project, …) =<br> project.pluginManager.withPlugin(name) { … }<br>// called for exactly three plugin ids:<br>configurePlugin(&quot;kotlin-multiplatform&quot;, …)<br>configurePlugin(&quot;kotlin-android&quot;, …)<br>configurePlugin(&quot;kotlin&quot;, …)</pre><p>If none of those three plugin ids is applied, none of the registration blocks ever run, and there’s no fallback or warning path.</p><p>Second, which of those ids does an AGP 9 built-in Kotlin module actually have? I wrote a small init script probe that any project can run:</p><pre>gradle.projectsEvaluated {<br> val p = rootProject.project(&quot;:blease-core&quot;)<br> val ext = p.extensions.findByName(&quot;kotlin&quot;)<br> println(&quot;kotlin extension: &quot; + (ext?.javaClass?.name ?: &quot;none&quot;))<br> listOf(<br> &quot;org.jetbrains.kotlin.android&quot;,<br> &quot;org.jetbrains.kotlin.jvm&quot;,<br> &quot;org.jetbrains.kotlin.multiplatform&quot;,<br> ).forEach { println(&quot;hasPlugin[$it] = &quot; + p.pluginManager.hasPlugin(it)) }<br>}</pre><p>Output on my stack:</p><pre>kotlin extension:<br>org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension_Decorated<br>hasPlugin[org.jetbrains.kotlin.android] = false<br>hasPlugin[org.jetbrains.kotlin.jvm] = false<br>hasPlugin[org.jetbrains.kotlin.multiplatform] = false</pre><p>AGP’s built-in Kotlin does apply an internal Kotlin plugin (<em>KotlinBaseApiPlugin</em> shows up in the plugin list), and it registers the completely normal <em>KotlinAndroidProjectExtension</em>. But the three plugin ids that BCV listens for are all absent. Put together, that fully explains the BCV failure: the plugin ids it waits for never appear, so its registration code never runs.</p><p>The <em>abiValidation</em> symptom needed a different probe. The extension is the standard type, so why doesn’t the DSL resolve? Reflection over the live extension object, walking its class and every supertype, found no <em>abiValidation</em> member at all on this stack. The accessor just isn’t there, so no syntax fix or opt-in on my side would help. Why it’s absent, whether this Kotlin version doesn’t expose it for Android or AGP’s variant omits it, I haven’t established from source, so I’m leaving that one open rather than guessing.</p><p>Dokka’s empty output fits the same pattern: its generated configuration contained zero source roots, consistent with an adapter that discovers Kotlin source sets through a model that isn’t being populated here. I didn’t read the adapter source, so for Dokka the mechanism is my best inference rather than something I confirmed. The fix, though, is verified and trivial. You bypass auto-detection and name the source roots yourself:</p><pre>dokka {<br> dokkaSourceSets.register(&quot;main&quot;) {<br> sourceRoots.from(&quot;src/main/java&quot;)<br> }<br>}</pre><p>With that, full documentation output came back.</p><h4>Other people hit this too</h4><p>While looking for prior reports I found <a href="https://github.com/Kotlin/binary-compatibility-validator/issues/312)">binary-compatibility-validator issue #312</a>, filed against a different version set (AGP 9.0.1, Kotlin 2.2.21, BCV 0.18.1) with the same symptom and the same diagnosis. The cross-references on that issue are a small survey of how teams respond to this class of problem: one project closed its AGP 9 upgrade PR and stayed on AGP 8, another removed BCV from the build entirely, and two, OkHttp<br>(<a href="https://github.com/square/okhttp/pull/9375">#9375</a>) and Elastic’s Android APM agent (<a href="https://github.com/elastic/apm-agent-android/pull/757">#757</a>), wrote workarounds.</p><p>There’s also an official acknowledgment. JetBrains tracks Android support for the built-in ABI validation as an open, unscheduled meta issue, <a href="https://youtrack.jetbrains.com/issue/KT-78025">KT-78025</a>. The Kotlin documentation meanwhile notes that the feature doesn’t apply to Kotlin/Android projects. The gap is known, the fix has no announced date, and I didn’t want to wait for it.</p><h4>The workaround, and packaging it</h4><p>The OkHttp and Elastic workarounds share one insight: BCV’s task classes are still on your classpath even when the plugin doesn’t register them. <em>KotlinApiBuildTask</em> produces the <em>.api</em> dump from compiled classes, and <em>KotlinApiCompareTask</em> diffs it against the committed file. Nothing stops you from registering those tasks yourself and feeding them the output of AGP’s compile tasks.</p><p>I didn’t want to hand-maintain that wiring in every module, so I packaged it as a small Gradle plugin: <a href="https://github.com/tjokinen/android-bcv-bridge">android-bcv-bridge</a>, published on the<br><a href="https://plugins.gradle.org/plugin/io.github.tjokinen.android-bcv-bridge">Gradle Plugin Portal</a>.</p><pre>plugins {<br> id(&quot;com.android.library&quot;)<br> id(&quot;io.github.tjokinen.android-bcv-bridge&quot;) version &quot;0.1.0&quot;<br>}</pre><p>It registers <em>releaseApiDump</em> and <em>releaseApiCheck</em> for an Android library module, feeds BCV’s own task types from the module’s compiled classes, and wires the check into <em>check</em>. Writing a real functional test for it (via Gradle TestKit) immediately exposed a packaging bug: BCV needs ASM at runtime but doesn’t declare it, and only gets away with it in real Android projects because AGP happens to pull ASM onto the build classpath. The plugin now ships that dependency explicitly.</p><p>A few caveats, since this is very much a stopgap: the plugin wires BCV internal types, so it’s pinned to a tested BCV version (0.18.1). It checks one<br>variant, <em>release</em> by default, while Android’s variant system means a debug-only or flavor-only API break would go unnoticed, which is exactly the complexity KT-78025 cites for why proper support is nontrivial. When KT-78025 lands, this plugin should be retired.</p><p>As validation, <a href="https://github.com/tjokinen/blease">blease</a>’s two library modules now run it in CI, and within a week the check caught two genuine breaking changes I made on purpose (an addressing refactor and a package rename) plus zero false positives. The committed <em>.api</em> diffs turned both breaks<br>into explicit, reviewable artifacts.</p><h4>What I took away</h4><p>The interesting part is how this failed: nothing errored. A whole category of Kotlin tooling discovers your code through the presence of the standalone Kotlin plugin, and a newer, cleaner build setup removed that plugin. Each tool looked for it, found nothing, and quietly concluded there was nothing to do.</p><p>I’m keeping three habits from this:</p><p>First, when you adopt a new build platform capability, the first-party path (compiling, running) works on day one. The ecosystem around it lags behind, and it does so quietly. Audit your tooling output after a major migration.</p><p>Second, verify the mechanism before writing down an explanation. My first theory about the <em>abiValidation</em> failure was that AGP’s built-in Kotlin hands you some stripped-down <em>kotlin {}</em> extension that simply lacks the DSL. I had already written that down as fact when a reflection probe showed the extension is the completely normal <em>KotlinAndroidProjectExtension</em>; the accessor just isn’t on it in this setup. A second explanation, suggested in the issue tracker (that the DSL only appears when the standalone <em>kotlin-android</em> plugin is applied), I still can’t confirm or refute from source, so it stays an open question rather than a conclusion. Twenty minutes of reading plugin source and reflecting over live objects turned one guess into a fact and demoted the other to “unknown”.</p><p>Third, when the fix is genuinely blocked upstream, package the workaround instead of copy-pasting it. The plugin took an evening on top of the investigation, and the next person googling <em>Task ‘apiDump’ not found</em> after an AGP 9 upgrade can now solve their problem with one plugin line, or at least understand it with this article.</p><p>If Android support lands in KT-78025 and makes all of this obsolete, so much the better. That’s the outcome I’m hoping for.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=974162978780" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>