我正在尝试通过https://developer.android.com/jetpack/compose/tutorial上的 Jetpack Compose 教程。我正在添加图像,并且正在使用他们提供的图像。
我已将其保存在资源管理器中。我在这里称呼它:
@Composable
fun MessageCard(msg: Message) {
Row() {
Image(painterResource(R.drawable.profile_picture),
"Profile picture"
)
Column() {
Text(text = msg.author)
Text(text = msg.body)
}
}
}
但我得到了错误java.lang.IllegalArgumentException: Only VectorDrawables and rasterized asset types are supported ex. PNG, JPG
。我已经检查了图像的标题字节,‰PNG
它们应该是这样的。我在这里错过了一些相当明显的东西吗?