I personally wasn't able to get the
resources
approach to work without errors, but I found what to me is a simpler approach that also hits up against fewer naming convention issues.
I also mostly just put things like images in each platform project separately, but for what files I do share, I use Android
"assets" rather than "resources". I use this to share some JSON files. Obviously this won't work for anything where e.g. Android
requires an XML resource, but for files you just read at runtime, it works great.
I have a folder
shared/src/commonMain/assets
and then the following config:
kotlin {
cocoapods {
extraSpecAttributes.apply {
this["resources"] = "'src/commonMain/assets/**/*'"
}
}
}
android {
sourceSets {
named("main") {
assets.srcDir("src/commonMain/assets")
}
}
}