Hello All - I am facing one issue below issue for ...
# compose-ios
n
Hello All - I am facing one issue below issue for below mentioned case. Added KMM library Module have compose view with images. Compose version 1.6.1 Kotlin : 1.9.20 Exported framework type :
XCFramework
When i import generated XCFramework to iOS app its getting crash with below error - Image resource missing.
Uncaught Kotlin exception: org.jetbrains.compose.resources.MissingResourceException: Missing resource with path: drawable/ic_referral_bubble.png
What else I have tried ? _*As per the 1.6.0 version document
<http://compose.re|compose.re>*_sources
hdpi/ldpi/xhdpi etc drawable folder and image as per resolution but after that it gives error with specific folder.
Uncaught Kotlin exception: org.jetbrains.compose.resources.MissingResourceException: Missing resource with path: drawable-xxhdpi/ic_referral_bubble.png
Can anyone please help me how can we resolve this issue. ? Is this because image resources are not getting added in
XCFramework
file ? Thanks
k
You cannot export your project with resources as a framework or XCFramework
🤔 1
Because it is Kotlin plugin artefacts. The compose resources can be included into an app only by the Compose gradle plugin
There is no kotlin multiplatform resources. Only compose multiplatform resources
Cc @Timofey Solonin
n
@Konstantin Tskhovrebov So theres no way to solve KMM library module which have compose UI with Images as a local assets. ?? And export to XCFramework and use that framework in iOS. Same framework working fine if I remove usage of images.
k
It is not supported yet. But TBH, a native world does not have a common way to have frameworks with resources. It's a build system responsibility usually. Take a look how it's done in the cocoapods, for example
💔 1
It means you may achieve what you want by framework + resources + special written podspec
n
is it possible if my library module is without cocoapods ?
k
You don't need the cocoapods for your library. Only for distribution frameworks together with resources
u
Your ressources must reside in the main KMM module:
Copy code
Multimodule projects are not supported yet. The JetBrains team is working on adding this functionality in future releases. For now, store all resources in the main application module.
https://blog.jetbrains.com/kotlin/2024/02/compose-multiplatform-1-6-0-release/#common-resources-api
💔 1
b
Moko is able to do it but requires using apps to setup moko resource generation too
n
@brandonmcansh Before
resource
dependecy tried with moko but same like resource error . 😢
b
hm too my knowledge and all test setups have it working. see here - https://github.com/BotStacks/compose-example/tree/main
see docs/compose/* for CMP
👀 1