BitmapFactory.decodeResource(getContext().getResources(), R.mipmap.ic_launcher);获取不到图片问题

我是使用的sdk的版本是28的,在模拟器上运行时发现这个bitmap为null.

BitmapFactory.decodeResource(getContext().getResources(), R.mipmap.ic_launcher);获取不到图片问题

 问题在于: 高版本sdk, 多出了一个xml,

BitmapFactory.decodeResource(getContext().getResources(), R.mipmap.ic_launcher);获取不到图片问题

 所以默认找到的是这个xml , 所以解析不出来bitmap, 如果遇到这个问题把图片该个名字就能解决了~~