<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/kotlin-s-jdk-release-compatibility-flag-clwz8knqf" -->

---
title: Kotlin&#x27;s JDK release compatibility flag | daily.dev
description: A real-world Android crash caused by a `NoSuchMethodError` on `List.removeFirst()` reveals a subtle but critical Kotlin/JVM cross-compilation pitfall. When the...
canonical: https://daily.dev/posts/kotlin-s-jdk-release-compatibility-flag-clwz8knqf
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Kotlin&#x27;s JDK release compatibility flag | daily.dev
og:description: A real-world Android crash caused by a `NoSuchMethodError` on `List.removeFirst()` reveals a subtle but critical Kotlin/JVM cross-compilation pitfall. When the...
og:url: https://daily.dev/posts/kotlin-s-jdk-release-compatibility-flag-clwz8knqf
og:image: https://api.daily.dev/og/posts/clWZ8kNQf.png
og:image:alt: Kotlin&#x27;s JDK release compatibility flag
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Kotlin's JDK release compatibility flag

**[Jake Wharton](https://daily.dev/sources/jakewharton)** · 5 min read · 0 upvotes · 0 comments

## Summary

A real-world Android crash caused by a `NoSuchMethodError` on `List.removeFirst()` reveals a subtle but critical Kotlin/JVM cross-compilation pitfall. When the build JDK was bumped to 21, the new `removeFirst()` member method added to `java.util.List` in JDK 21 silently took precedence over Kotlin's extension function of the same name — even though `jvmTarget` was set to 1.8. This is because `jvmTarget` only controls the bytecode version emitted, not which JDK APIs are visible during compilation. The fix is Kotlin's `-Xjdk-release` flag (introduced in Kotlin 1.7), which mirrors `javac`'s `--release` flag by restricting available APIs to the specified JDK version. Android targets are unaffected since `android.jar` already limits the visible Java APIs. A Gradle DSL for this flag is tracked in KT-49746 but not yet available.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://jakewharton.com/kotlins-jdk-release-compatibility-flag>

## Similar posts on daily.dev

- [Kotlin 2.3.20 harmonizes with C, JavaScript/Typescript](https://daily.dev/posts/kotlin-2-3-20-harmonizes-with-c-javascript-typescript-hddvbwasn) · InfoWorld · 4 upvotes · 0 comments
- [How Gradle Is Javamaxxing](https://daily.dev/posts/how-gradle-is-javamaxxing-knrrqwz9d) · Gradle Blog · 28 upvotes · 1 comments

---

Tags: [#java](https://daily.dev/tags/java), [#android](https://daily.dev/tags/android), [#kotlin](https://daily.dev/tags/kotlin), [#jvm](https://daily.dev/tags/jvm), [#gradle](https://daily.dev/tags/gradle)

[View this post on daily.dev](https://daily.dev/posts/kotlin-s-jdk-release-compatibility-flag-clwz8knqf)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Kotlin's JDK release compatibility flag","url":"https://daily.dev/posts/kotlin-s-jdk-release-compatibility-flag-clwz8knqf","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/kotlin-s-jdk-release-compatibility-flag-clwz8knqf"},"datePublished":"2026-07-05T07:13:37.784Z","dateModified":"2026-07-05T07:15:15.415Z","description":"A real-world Android crash caused by a `NoSuchMethodError` on `List.removeFirst()` reveals a subtle but critical Kotlin/JVM cross-compilation pitfall. When the...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/783b359bc344ce8763770516ac461830?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/783b359bc344ce8763770516ac461830?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Jake Wharton","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Jake Wharton","logo":"https://media.daily.dev/image/upload/logos/placeholder.jpg","url":"https://daily.dev/sources/jakewharton"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/kotlin-s-jdk-release-compatibility-flag-clwz8knqf","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"java,android,kotlin,jvm,gradle","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Jake Wharton","item":"https://daily.dev/sources/jakewharton"},{"@type":"ListItem","position":3,"name":"Kotlin's JDK release compatibility flag"}]}
```

