Jake Wharton describes a duplicate class error caused by having two copies of the Compose runtime on Android when using Redwood, a multiplatform Compose project. The root cause is that Gradle treats Redwood's custom-built Compose runtime and Google's official Compose runtime as separate artifacts. The solution involves manipulating Gradle module metadata (the .module JSON file) via a text-substitution hack in the generateMetadataFileForKotlinMultiplatformPublication task, replacing the Android variant's available-at redirect with a dependencies entry pointing directly at Google's official Compose runtime artifact. This avoids the duplicate class problem without requiring consumers to understand the build internals. The post also notes that the problem persists for other platforms (JVM, web) and calls on Google or JetBrains to ship a proper multiplatform Compose runtime artifact.

7m read timeFrom jakewharton.com
Post cover image
Table of contents
Gradle module metadataModifying Gradle module metadata