D/skia: --- Failed to create image decoder with message 'unimplemented'

Ajinkya kadam picture Ajinkya kadam · Feb 5, 2020 · Viewed 16.2k times · Source

i am using https://github.com/jhansireddy/AndroidScannerDemo this scan library in my project.

when i capture image i am getting D/skia: --- Failed to create image decoder with message 'unimplemented' in console and The captured image not sets to imageview in Android P.

also when i am testing same app in Android Q i am getting below error.

2020-02-05 11:32:23.668 9270-9270/? E/ReviewScreenImpl: onClickOKButton() - Fail to decode captured picture

Can someone please help on above issues.

Answer

kAvEh picture kAvEh · Mar 31, 2020

I have the same problem and it seems there is a bug in getResources not in library you used because I don`t use it. but, you can use ResourcesCompat instead, like this:

val myLogo = (ResourcesCompat.getDrawable(this.resources, R.drawable.ic_home_black_24dp, null) as VectorDrawable).toBitmap()

or

val myLogo = (ResourcesCompat.getDrawable(this.resources, R.drawable.ic_home_black_24dp, null) as BitmapDrawable).bitmap

depend on your drawable type(vector or image).

be aware that this will only run on API > 22.