I am trying to display an image with jetpack compo...
# compose
r
I am trying to display an image with jetpack compose… which is a normal PNG file inside drawable directory:
…res/drawable-xxxhdpi/ic_test.png
the code I use:
Copy code
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?
t
You call looks correct. Maybe do you have an other vector drawable with the same name?
👍 1
r
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
1189 Views