So i went through this video for using Compose Multiplatform for Android / IOS UI, specifically how to use the
Image()
to render an image.
However, when i try the same with a .png image Android studio cannot seem to locate the file. I am importing the asset through resource manager but i think the asset ends up in the androidApp folder instead of commonMain. So i made a
Resources
folder inside commonMain manually but it still cannot find the image. Does anyone know the right way to import assets that can be used inside the commonMain folder?
https://youtu.be/FWVi4aV36d8?t=2029▾
i
Ivan Matkov
06/14/2023, 12:49 PM
Placing pngs to
commonMain/resources
folder should just work. You can use this template or other our examples as a reference
In your case I guess the problem is in folder name
Resources
instead of
resources
.
n
Nav
06/15/2023, 12:13 AM
@Ivan Matkov
Thanks for the reply. Actually my folder is named
resources
correctly. I will try the examples link you sent and try to figure out the issue.
Do you know of a way that i can find out which folder path the
painterResource
is scanning for the image? Maybe my project structure might be at fault here.
Nav
06/15/2023, 1:35 AM
@Ivan Matkov
Hmm.. this is odd. When i do mouseover on the
logo.png
Android Studio shows me the correct logo so i guess it can detect it properly 🤔