Hello, is it possible to add a `KMP` module to a c...
# compose-ios
r
Hello, is it possible to add a
KMP
module to a compose multiplatform project ? Desktop / Android works, but iOS fail when I add it.
Copy code
The following build commands failed:
	PhaseScriptExecution [CP-User]\ Build\ shared /Users/xxxx/Documents/Projects/porject-xxx/build/ios/Pods.build/Debug-iphonesimulator/shared.build/Script-BEA8885189D408D600647BDC228A6A20.sh (in target 'shared' from project 'Pods')
(1 failure)
EDIT: After adding
Copy code
cocoapods {
        ...
        framework {
            baseName = "shared"
            isStatic = true
            export(project(":xxx:xxx"))
            transitiveExport = false // This is default.
            // Bitcode embedding
            embedBitcode(org.jetbrains.kotlin.gradle.plugin.mpp.BitcodeEmbeddingMode.BITCODE)
        }
        ...
    }
I got another error
Copy code
error: Could not find "My" in [/Users/xxxx/Documents/Projects/xxx-xxx-xx/iosApp/Pods, /Users/xxx/.konan/klib, /Users/xxx/.konan/kotlin-native-prebuilt-macos-aarch64-1.8.20/klib/common, /Users/xxx/.konan/kotlin-native-prebuilt-macos-aarch64-1.8.20/klib/platform/ios_simulator_arm64]
d
Maybe you also added macos target as well? In this case better to remove it from gradle.
r
No only jvm(“desktop”), I tried commenting everything except iOS target, but error. I tried with compose-ios template from JetBrains, and an new empty kmm module. But I still get an error if add the module, without it works.
d
r
Did the same test, clone build run -> OK, then I added my kmp module to the shared common dependencies, and then get the error. It’s
cocoapods
conf problem ? I have checked, I have the same target between both module
d
A good point to understand that's wrong — is creating minimal reproducible sample. Remove almost all code from your project and share this project on GitHub.
r
Ok, I’ll make a sample
Do I enter an issue on youtrack ?
d
Made Pull Request to fix your sample project https://github.com/doTTTTT/compose-kmp-test/pull/1 You should use isStatic = true for now. Later we will fix it.
r
I tried only
isStatus = true
, do not compile. But with
api
instead of
implementation
it works. Thank’s !
d
Thanks to you, we found another issue with space character in settings.gradle rootProject.name="My Application". Describe it here: https://github.com/dima-avdeev-jb/kotlin-gradle-plugin-ios-root-project-name-with-space
Do I enter an issue on youtrack ?
You don't need to create additional issues for now, we already have it.
r
Thank’s for your help !