Hello guys, I am trying to share some resources on...
# multiplatform
a
Hello guys, I am trying to share some resources on my KMP project. Android and Desktop are working fine.
Ios is crashing on me because of
Uncaught Kotlin exception: org.jetbrains.compose.resources.MissingResourceException: Missing resource with path: /Users/arsildo/Library/Developer/CoreSimulator/Devices/72545AB6-79B0-4A9E-AE04-7863D01FB0B5/data/Containers/Bundle/Application/9C37D7C2-7E25-4E56-895B-5ED30A51AC7D/Joga.app/compose-resources/composeResources/joga.shared_core.design_system.generated.resources/font/inter_regular.ttf
Project structure looks like this
image.png
image.png
I cant seem to bundle my resources into the ios app
not sure how to achieve this using spm
y
In common-> ios app add resources folder and then add your resources there
a
I already tried this, but i had no luck I was still crashing
/Users/arsildo/Library/Developer/CoreSimulator/Devices/72545AB6-79B0-4A9E-AE04-7863D01FB0B5/data/Containers/Bundle/Application/9C37D7C2-7E25-4E56-895B-5ED30A51AC7D/Joga.app/compose-resources/composeResources/joga.shared_core.design_system.generated.resources/font/inter_regular.ttf
the path seems like its bundling the resources into the shared module
y
The ios model inside the comoposeapp module
a
I can try
let me check, thanks
i will try and build now
composeApp Module
y
i think this is what he meant
a
I do not have an ios target for the composeApp rn
maybe this is the issue
I was trying to use both Swift ui and compose at the same time
y
where is exactly is your main.kt to run your ios app there you should add resources
a
does this look right to you?
y
sure
a
Ok finally sorted it out
it wasnt because i had no composeRes folder on ios
it was because my shared module was not configured to actually generate resources as the ios entry point
thanks for the idea guys
y
the other person was also me you got fooled but ya no worries
a
Yes I got that
Thank you Youssef
v
Could you please share the solution? I am facing the same issue.
a
Hi, do you have a shared folder in your project or the composeApp Folder?
which one is your umbrella module to ios
y
as of right now if you are using the latest version you wont need to include a res folder in your ios module
a
you do need to export still if you have any modules
v
I have a shared folder. It
I have a shared module. It's not exporting the modules. Let me try that.
I added my dependencies in iosMain like this ui:shared/build.gradle.kts
Copy code
iosMain {
    dependencies {
        api(projects.ui.homepage)
    }
}
and exported them ui:shared/build.gradle.kts
Copy code
targets.withType<KotlinNativeTarget>().configureEach {
    binaries.framework {
        isStatic = true
        baseName = "KafkaKt"
        
        export(projects.ui.homepage)
    }
}
But still facing the same issue.
d
@Vipulyaara did you get a solution to the issue. Iam facing a similar issue too
270 Views