调用
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);canvas.drawBitmap(bitmap, 50, 50, paintText);
问题发生在什么位置?
D/skia: --- Failed to create image decoder with message 'unimplemented'....java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.graphics.Bitmap.isRecycled()'on a null object reference
使用bitmap的时候异常提示,经过Log确认,bitmap是空
原因
bitmap是null,表明BitmapFactory.decodeResource图像解码存在问题,后查明是ic_launch这张系统图片存在同名xml文件,导致找不到图片进行解码
解决
不使用ic_launcher这个文件就好用了