D/skia: --- 无法创建带有消息“未实现”的图像解码器

Aji*_*dam 13 android android-manifest android-camera android-fileprovider

我在我的项目中使用https://github.com/jhansireddy/AndroidScannerDemo这个扫描库。

当我捕获图像时,我进入D/skia: --- Failed to create image decoder with message 'unimplemented'控制台并且捕获的图像未设置为Android P 中的图像视图。

同样,当我在Android Q 中测试相同的应用程序时,出现以下错误。

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

有人可以帮助解决上述问题。

小智 3

我有同样的问题,似乎 getResources 中有一个错误,而不是您使用的库中,因为我不使用它。但是,您可以使用 ResourcesCompat 代替,如下所示:

val myLogo = (ResourcesCompat.getDrawable(this.resources, R.drawable.ic_home_black_24dp, null) as VectorDrawable).toBitmap()
Run Code Online (Sandbox Code Playgroud)

或者

val myLogo = (ResourcesCompat.getDrawable(this.resources, R.drawable.ic_home_black_24dp, null) as BitmapDrawable).bitmap
Run Code Online (Sandbox Code Playgroud)

取决于您的可绘制类型(矢量或图像)。

请注意,这只能在 API > 22 上运行。