Arnaud Schildknecht
07/31/2026, 7:58 AMβββ androidApp/
βββ iOSApp/
βββ shared/
|
βββ core/
| βββ build.gradle.kts
βββ feature/
|
βββ featureA/
| βββ build.gradle.kts
βββ featureB/
βββ build.gradle.kts
Each build.gradle file makes the module available for Swift and Android with something like:
kotlin {
android {
namespace = "..."
...
}
@OptIn(ExperimentalSwiftExportDsl::class)
swiftExport {
moduleName = "..."
flattenPackage = "..."
}
}
Then I try to compile the iOS project and I get errors such as :
Unable to resolve module dependency: 'ExportedKotlinPackages'
Unable to resolve module dependency: 'KotlinRuntimeSupport'
I've managed to reproduce the problem with the official sample, by adding the android directive to any of the module (shared, module-a and module-b). It looks like swiftExport and android can't be declared in the same module.
At the end, I managed to fix the problem by creating an umbrella module, which does the swift export for every modules, only letting the android app use directly the other modules. Is it a known issue, or it might be normal? The way to structure a KMP project with Swift Export seems to be different to the Obj-C export.
Is using an umbrella module the right solution? Why can't I export a module directly for Android and Swift?Artem Olkov
08/03/2026, 12:19 PMEach build.gradle file makes the module available for SwiftThat is not correct. With swift export umbrella module is not gone - the whole world compilation model on the side of kotlin compiler is still there. With swift export project structure on the side of KMM should be the same - an umbrella module defining what and how would be exported.
The way to structure a KMP project with Swift Export seems to be different to the Obj-C export.Nope, the recommended structure for both of the exports is the same π kotlinlang.org/docs/multiplatform/multiplatforβ¦#β¦
Is using an umbrella module the right solution?Yes, it is
Why can't I export a module directly for Android and Swift?You can. Each kotlin klib/project would be exposed to swift and swift would see it as a separate module. Umbrella module on the side of KMP is a project that defines the nuances of what and how should be built, and what and how should be exposed.
Arnaud Schildknecht
08/03/2026, 1:14 PM./gradlew :sharedKit:embedSwiftExportForXcode), so I think the problem is that the shared bit is compiled many times instead of one. See the attached example swift-export-tma.
I've introduced an umbrella framework in the iOS app, which is only responsible to bridge the shared bit with the iOS app, making the shared code compiled only once, then used by the features requiring it. I'm still looking into how to setup my iOS project properly, because I keep getting these kinds of errors and I don't really get why.Artem Olkov
08/03/2026, 1:55 PMArnaud Schildknecht
08/03/2026, 2:22 PM``embedSwiftExportForXcode`` should be called only once, from the "host" targetIs it mandatory to call it from the host target? Or it can be called only from an "bridge" framework? For example :
βββ iOSApp/
βββ iOSApp/ // Host app. Dependency with sharedBridge
| βββ iOSApp.swift
βββ feature/
| βββ featureA/ // Dependency with sharedBridge
| βββ featureB/ // Dependency with sharedBridge
βββ sharedBridge/ // Framework bridge to the KMP shared module => calls embedSwiftExportForXcodeArtem Olkov
08/03/2026, 2:28 PMArnaud Schildknecht
08/04/2026, 12:14 PMExportedKotlinPackages and KotlinRuntimeSupport and I can't point the finger on what's missing.Artem Olkov
08/04/2026, 12:15 PMArnaud Schildknecht
08/04/2026, 12:45 PMArnaud Schildknecht
08/04/2026, 12:50 PM2.4.20-Beta2 in the sample. I used 2.4.10 most of the time and I got the same error.
It's just that I get another error with the Beta version (related to Koin), but if you get there, it means you fixed the issue πArnaud Schildknecht
09/08/2026, 8:58 AMArtem Olkov
09/08/2026, 11:12 AM