English 中文(简体)
D/skia: --- Failed to create image decoder with message unimplemented
原标题:

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.

问题回答

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.

Please pass the image byte string, instead of passing a simple string, into your decoder BitmapFactory.decodeStream method.

Make sure you have generated the image Uri which you will be sending with Intent to the camera app with the FileProvider.

The image uri where the camera app will save the picture before returning Activity.RESULT_OK should be generated with FileProvider like this

FileProvider.getUriForFile(
        context,
        context.getString(R.string.file_sharing_authority),
        File(filePath)

For more information about how to share our file to other apps (like the camera app) to be read or written into, see https://developer.android.com/reference/androidx/core/content/FileProvider

This bug originates from Android Studio emulator and probably has nothing to do with the API/library you choose, whether in native Android or Flutter. I had this problem once in a while, where it only took place in emulator. All network/online pictures can t be displayed on app and above error messages were shown all over the place. My app ran fine on my USB connected phone though.

Updating/redownloading the image for the emulator fixed the issue.





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签