Radoslaw Juszczyk

03/12/2021, 8:43 AM
I am trying to display an image with jetpack compose… which is a normal PNG file inside drawable directory:
the code I use:
Image(painter = painterResource(id = R.drawable.ic_test), contentDescription = "Test")
produces this exception:
java.lang.IllegalArgumentException: Only VectorDrawables and rasterized asset types are supported ex. PNG, JPG
What am I doing wrong?

Timo Drick

03/12/2021, 8:47 AM
You call looks correct. Maybe do you have an other vector drawable with the same name?
👍 1

Radoslaw Juszczyk

03/12/2021, 8:52 AM
Thanks @Timo Drick, turned out the problem was with the image file ( I was looking for the issue in a wrong place) The file was saved with photoshop and weighed 8MB (I guess PS saved it with some extra data)…
👍 1