Search code examples
androidkotlinbitmapcoil

Using Coil library - imageView.draw(canvas) - Software rendering doesn't support hardware bitmaps


This occur when try to draw canvas from imageView which using Coil to load image.

Could you help me solve problem? Thank you all

 fun loadImageFromUrl() {
        bodyImageView?.load(imagePathServer)
    }

This is code for draw bitmap from imageview

fun getBitmapFromView(view: View?): Bitmap? {
        var bitmap =
            Bitmap.createBitmap(view!!.width, view.height, Bitmap.Config.ARGB_8888)
        var canvas = Canvas(bitmap)
        view.draw(canvas)
        return bitmap
    }

Problem is shown

l


Solution

  • And I found a way to solve problem that just add allowHardware(false) in side load image and it worked. This is description why crash happed.

       bodyImageView?.load(imagePathServer) {
                allowHardware(false)
            }