In a `KMP/CMP` project, I have a module that conta...
# multiplatform
i
In a
KMP/CMP
project, I have a module that contains resources (images and strings) correctly placed in the
composeResources
folder. This module is declared as a library using the
com.android.kotlin.multiplatform.library
plugin. When I run the application, it crashes with the following error:
Missing resource with path: composeResources/com.myaproject.resources/drawable/compose-multiplatform.xml
However, if I replace the
com.android.kotlin.multiplatform.library
plugin with the
com.android.library
plugin, everything works fine. Do you have an explanation for this behavior? Could I be missing a specific configuration related to the KMP/CMP plugin or to resource handling in this setup?
c
In #CJLTWPH7S you‘d reached the right people for your question.
m
Hi, maybe look at this for a solution https://funkymuse.dev/posts/kmp-multi-module-resources/
s
Could you please confirm if you've enabled the resources for that particular module? See: https://developer.android.com/kotlin/multiplatform/plugin#enable-android-res
i
Thank you for your feedback, I solved my problem.
I added
androidResources { enable = true }
to the
androidLibrary
declaration. More details are in the link provided by @Sudarshan. ⬆️