• Kotlin’s JDK release compatibility flag

    Yesterday, our Android app crashed with a weird NoSuchMethodError. java.lang.NoSuchMethodError: No interface method removeFirst()Ljava/lang/Object; in class Ljava/util/List; or its super classes (declaration of ‘java.util.List’ appears in /apex/com.android.art/javalib/core-oj.jar) at app.cash.redwood.lazylayout.widget.LazyListUpdateProcessor.onEndChanges(SourceFile:165) at app.cash.redwood.lazylayout.view.ViewLazyList.onEndChanges(SourceFile:210) at app.cash.redwood.protocol.widget.ProtocolBridge.sendChanges(SourceFile:125) at app.cash.redwood.treehouse.ViewContentCodeBinding.receiveChangesOnUiDispatcher(SourceFile:419) at app.cash.redwood.treehouse.ViewContentCodeBinding$sendChanges$1.invokeSuspend(SourceFile:383) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:33) at kotlinx.coroutines.DispatchedTask.run(SourceFile:104) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:250) at android.app.ActivityThread.main(ActivityThread.java:7868) The offending code is written in…

    Read More

  • Gradle toolchains are rarely a good idea

    The last post featured some Kotlin code inadvertently targeting a new Java API when the build JDK was bumped to 21. This can be solved with the -Xjdk-release Kotlin compiler flag, or by using Gradle toolchains to build with an old JDK. If you read the Gradle docs… Using Java toolchains is a preferred way…

    Read More

  • Nonsensical Maven is still a Gradle problem

    There was a time when I used Maven heavily, but today all the libraries I work on build with Gradle. Even though I’m publishing with Gradle, consumers can use Gradle, Maven, Bazel, jars in libs/ (but please don’t), or anything else. That’s a huge JVM ecosystem win! In general, I don’t have to think about…

    Read More

  • Using Renovate to update build JDK

    You want to be using the latest JDK for development. Don’t use Gradle toolchains, they’ll needlessly force you to use old JDKs. You can still target and test on old JVM versions but develop with the latest and greatest. Java and the JDK are literally built for this. Locally this hasn’t been a problem. Homebrew…

    Read More

  • Multiplatform Compose and Gradle module metadata abuse

    My primary work project for the better part of a year (named Redwood) is built on top of Compose1 and runs on every platform that Kotlin supports. This of course means Android, but we also have Compose running on iOS, the web, the JVM, and all other native targets. It’s truly a multiplatform Compose project2.…

    Read More

  • Slope-intercept library design

    The equation y=mx+b defines a line in slope-intercept form. The line will intercept the y-axis at the value b and for each change in x its slope (the amount the line goes up or down) will change by m. Slope-intercept gives me a way to think about the design of libraries in relation to each…

    Read More