Sitemap
Adaptive AI Architecture

Adaptive Content Architecture will simplify how you design, develop, deploy, and publish any applications. Even for native mobile-apps. Whether your “content” is local or remote, following these design patterns will simplify overall app development.

Kotlin Multiplatform Setup

5 min readJan 24, 2026

--

[November 11, 2026] UPDATE:
- Major refactoring to match project structure from KMP plugin wizard.
-
Android Studio Rabbit 2| 2026.2.2 Patch 1works without issues — most likely, you will need to clean all caches.
- Kotlin Multiplatform plugin
262.10968.183-ASworks as expected.
- The
kmpAcme reference project has also updated to use the Android Gradle plugin v9.5.1 and Gradle v9.8.2.
- Kotlin upgraded to
2.4.21
- Reference implemention to call API endpoint handling all edge-cases
- Repository
https://github.com/migueltt/kmpAcme defines an up-to-date reference project.

There are several things that can be really annoying when setting up a new Kotlin Multiplatform (KMP) project — this article fixes almost everything for you!
Note that more technical articles will be added as we move along.

This is a technical addendum for the Adaptive AI Architecture series. Just to help you out on setting the technical foundations.

Creating the initial project

It is highly recommended to use AndroidStudio if you are planning to develop an Android mobile-app. If you are using macOS, you can get iOS builds as well. Web and Desktop are just add-ons.

  1. Install AndroidStudio
  2. Install the Kotlin Multiplatform plugin
  3. Create a new Project — select Kotlin DSL for build configuration language
  4. Select Android, iOS, Desktop, Web, Server — enabling “Share UI”

Several modules will be created as depicted in Create your Compose Multiplatform app.

Adjusting Project Structure

With the introduction of Android-Gradle-Plugin 9+, several things have changed, and most likely, the default project we just created will throw a lot of warnings, if not errors.

Don’t worry, we will sort that out!

From a Gradle perspective, start modifying your Project structure as follows — or just clone the kmpAcme reference PoC:

+ <project-root>
+ app/
+ androidApp/
| + src/
| + build.gradle.kts
+ desktopApp/
| + src/
| + build.gradle.kts
+ iosApp/
| + iosApp/
| + Frameworks
+ webApp/
| + src/
| + build.gradle.kts
+ gradle/
| + wrapper/
| | + gradle-wrapper.properties
| + libs.versions.toml
+ kmpCompose/
| + src/
| + build.gradle.kts
+ kmpServerApp/
| + src/
| + build.gradle.kts
+ kmpShared/
| + src/
| + build.gradle.kts
+ build.gradle.kts
+ gradle.properties
+ settings.gradle.kts

Tip: this structure is similar to the one described in KMP/CMP Project Structure.

Don’t worry, I’ll cover all the src directories later, plus the iosApp directory.

<project-root>/gradle.properties

Since we’ve added some tasks to generate ModuleBuildConfig classes, the org.gradle.configuration-cache must be false :

<project-root>/settings.gradle.kts

Mostly unchanged, except for the include statements at the end:

<project-root>/gradle/wrapper/gradle-wrapper.properties

Mostly unchanged, except for the gradle version — adjust as required, but it is recommended 9 or higher:

<project-root>/gradle/libs.versions.toml

We will use the latest (stable) libraries and Android Gradle Plugin:

<project-root>/build.gradle.kts

We will include spotless to help out with code conventions. Note that ij_kotlin_imports_layout includes these patterns:

"*,|,com.acme.kmp.shared.kmpshared.**,|,com.acme.kmp.compose.kmpcompose.**,|,com.acme.**"

This is because each gradle module sets group to its proper package, which is used to generate the ModuleBuildConfig — thus, the default module name is no longer applicable.

For example, generated KMP resources are defined under package com.acme.kmp.compose.kmpcompose.generated.resources.

IMPORTANT: Notice that task moduleBuildConfig will create ModuleBuildConfig for each module, similar to the BuildConfig for those familiar with Android projects. For now, it will include constants related to each module using Kotlin-Multiplatform plugin within its gradle build.gradle.kts file:

  • const val MODULE_ID → Gradle project.name
  • const val MODULE_NAME → Gradle project.description
  • const val MODULE_VERSION → Gradle project.version
  • const val MODULE_GROUP → Gradle project.group → package name

ModuleBuildConfig is generated for every single module under build/generated/sources/moduleBuildConfig/kotlin/<package-dirs>.

Get Miguel T’s stories in your inbox

Join Medium for free to get updates from this writer.

Every time a module attribute changes, these files are auto-generated.

<project-root>/kmpShared/build.gradle.kts

Module kmpShared will contain:

  • Unified Data Models — this will help out keeping consistency across API paylods on Front-End and Back-End implementations
  • Repostory / API patterns
  • API integration

You can decouple different aspects as library modules — but to start, just keep things simple:

<project-root>/kmpCompose/build.gradle.kts

This module will define the shared-UI for all target platforms, using Data-Models from kmpShared.
These changes allow to visualize a @Composable using @Preview.

<project-root>/kmpServerApp/build.gradle.kts

This module will implement API endpoints (microservices) using Ktor and will reuse all the Data-Models as defined in module kmpShared.

<project-root>/app/androidApp/build.gradle.kts

This module will be used for the Android mobile build. This implementation must rely as much as possible on the components defined in module kmpCompose.

<project-root>/app/desktopApp/build.gradle.kts

This module will be used for the Desktop JVM-based build. This implementation must rely as much as possible on the components defined in module kmpCompose.

<project-root>/app/webApp/build.gradle.kts

This module will be used for the web app build. This supports both javascript and web-assembly variants. This implementation must rely as much as possible on the components defined in module kmpCompose.

Synchronize Gradle

After all these changes, synchronize gradle and clean / build your project.

You may need to delete your <user-home>/.gradle directory (it will be recreated )— sometimes if you are behind a proxy, dependencies may point to different URLs.

Some warnings may appear due to the experimental compiler options we’ve added.

Verifying builds on all platforms

Below is the KMP/CMP running in all its glory on all four target platforms, using the same composable App as defined in kmpCompose/src/commonMain/kotlin/<your-package>/App.kt :

Press enter or click to view image in full size
Desktop, Web, iOS, Android
  • All platforms support both Dark and Light mode, as shown above.
  • It includes the default “Click me!” created with the KMP Wizard and an additional “Call API” section to call a mock API.

Android KMP/CMP app

Select and run app/androidApp as usual — nothing else to do.

iOS KMP/CMP app

Update the import statement in app/iosApp/iosApp/ContentView.swift:

import UIKit
import SwiftUI
// We updated `baseName` in <project-root>/kmpCompose/build.gradle.kts
import KmpCompose

struct ComposeView: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> UIViewController {
MainViewControllerKt.mainViewController()
}

func updateUIViewController(_ uiViewController: UIViewController, context: Context) {}
}

struct ContentView: View {
var body: some View {
ComposeView()
.ignoresSafeArea()
}
}

In AndroidStudio, switch to “Files” in Project navigator and open app/iosApp/iosApp.xcodeproj/project.pbxproj. Search for :composeApp: and replace with :kmpCompose: (1 entry only) — we changed the module name after all.

Desktop (JVM) KMP/CMP app

In module app/desktopApp, execute src/main/kotlin/<your-package>/Main.main() — adjust the title argument.

Web KMP/CMP app

In module app/webApp, execute src/webMain/kotlin/<your-package>/Main.main() — adjust title in src/webMain/resources/index.html
Also verify the script tag iswebApp.js— it should match the module name.

As you have noticed, there are several things that are still considered a work-in-progress. Gradle Plugins may be difficult to identify and include, affecting the overall project build process.
This configuration will help you out on your initial journey. I will try to update this guide as new updates are provided.

Jetbrains and Google have published some articles around KMP and Plugins:

imho: these guides should be providing a better guidance if KMP wants to be successful. I went through great lengths to troubleshoot most of the issues.

Next: Kotlin Multiplatform Setup (2) — API calls introduces basic Data-Models and API integration through Ktor.

--

Adaptive AI Architecture
Adaptive AI Architecture

Published in Adaptive AI Architecture

Adaptive Content Architecture will simplify how you design, develop, deploy, and publish any applications. Even for native mobile-apps. Whether your “content” is local or remote, following these design patterns will simplify overall app development.