Build a target. Map the project.
Start with the desktop app for the shortest feedback loop, then connect the Gradle model to the folders you will read throughout this guide.
Before you start
Yokan is a Compose Multiplatform application targeting Android, desktop JVM, and iOS. You only need one runnable target to follow the guide.
| Tool | Required for | Why |
|---|---|---|
| JDK 21 | All Gradle work | Runs Gradle and the desktop target. Android bytecode is configured for JVM 17 separately. |
| Android SDK | Android | Build tools, platform APIs, emulator, and APK packaging. |
| Xcode | iOS on macOS | Compiles the SwiftUI host and links the Kotlin/Native framework. |
settings.gradle.kts includes ../yokan-ext. Keep the extension project beside this checkout, or replace that composite-build substitution with a resolvable published dependency before syncing Gradle.
Run your first target
Desktop has no emulator or Xcode handoff, so it is the best first proof that your JDK, Gradle, source sets, generated resources, and shared UI are wired correctly.
export JAVA_HOME=$(/usr/libexec/java_home -v 21) # macOS
./gradlew :composeApp:run
Once the desktop window opens, the same shared YokanApp() composition can be built for the other targets:
# Android debug APK
./gradlew :androidApp:assembleDebug
# Shared tests on the desktop JVM
./gradlew :composeApp:desktopTest
# iOS simulator framework
./gradlew :composeApp:linkDebugFrameworkIosSimulatorArm64
# Then run the native iOS host
open iosApp/iosApp.xcodeproj
commonTest is compiled into platform test executables. The desktop JVM target is fast and can execute most shared domain, service, and state tests without a simulator.
Read the Gradle model
Open composeApp/build.gradle.kts and find kotlin { sourceSets { ... } }. The block defines a dependency graph, not independent folders.
Three source-set rules
- A child source set can use declarations and dependencies from every source set it
dependsOn. commonMaincannot import Android, JVM, or Apple APIs. Its declarations must compile for every target.- Intermediate source sets share capability between a subset of targets. Yokan uses this to avoid duplicating JVM engines and Android/iOS WebView code.
Tour the folders
Do not begin by reading every screen. First learn which layer owns each kind of decision.
The iOS host is intentionally small. Android and desktop also have thin entry points; the product is assembled in shared Kotlin.
Your first inspection
Trace the HTTP client factory. The shared service contract declares one capability; each target selects an engine:
expect fun createPlatformHttpService(): HttpService
// androidMain + desktopMain
actual fun createPlatformHttpService(): HttpService =
KtorHttpService(OkHttp.create())
// iosMain
actual fun createPlatformHttpService(): HttpService =
KtorHttpService(Darwin.create())
- Find the common
expectdeclaration. - Open the Android, desktop, and iOS
actualfiles. - Find the engine dependencies in their corresponding source sets.
- Notice that callers depend on
HttpService, not on OkHttp or Darwin.
Common setup problems
| Symptom | Check |
|---|---|
| Unsupported Java version | Confirm java -version and JAVA_HOME both point to JDK 21. |
| Included build missing | Place yokan-ext beside this repository so ../yokan-ext resolves. |
| iOS framework not found | Build the simulator framework, then let Xcode run BuildSharedFramework.sh from the host project. |
| Room generated code missing | Use the Gradle tasks rather than compiling files directly; KSP runs once per configured target. |