Developing a KMP Compose library was fun until I r...
# compose-desktop
h
Developing a KMP Compose library was fun until I realized that Android apps cannot depend on KMP compose libraries without applying
org.jetbrains.compose
plugin. This was unfortunate because I didn't feel right telling developers that they need to apply Desktop Compose plugin for their pure Android app just to use a library. Luckily, this turns out to be just a dependency issue and dependencies are easily replaced in gradle before they are resolved. Adding the following configuration to Android App's
build.gradle
enables the use of KMP Compose dependencies.
Copy code
configurations.all {
  resolutionStrategy.eachDependency { DependencyResolveDetails details ->
    if (details.requested.group.contains('org.jetbrains.compose')) {
      def groupName = details.requested.group.replace("org.jetbrains.compose", "androidx.compose")
      details.useTarget(
          [group: groupName, name: details.requested.name, version: details.requested.version]
      )
    }
  }
}