Glide: RuntimeException: setDataSource failed

Created on 12 Feb 2016  路  21Comments  路  Source: bumptech/glide

Glide load from file path error
Using method as

private void setImageWithGlide(final int messageType, final MessageViewHolder holder, File imgFile, final int Position) {
Glide.with(context)
     .load(imgFile.getPath())
     .asBitmap()
     .listener(new RequestListener < String, Bitmap > () {
      @Override
      public boolean onException(Exception e, String model, Target < Bitmap > target, boolean isFirstResource) {
       return false;
      }

      @Override
      public boolean onResourceReady(Bitmap resource, String model, Target < Bitmap > target, boolean isFromMemoryCache, boolean isFirstResource) {
       if (holder.getAdapterPosition() == Position)
        setMessageImage(messageType, holder, resource);
       return true;
      }
     })
     .override(holder.msg_img.getLayoutParams().width, holder.msg_img.getLayoutParams().height)
     .fitCenter()
     .signature(new MediaStoreSignature("", imgFile.lastModified(), 0))
     .into(holder.msg_img);
}

And onException called and get below stack trace as

Glide Error : Thread:main Exception:java.lang.RuntimeException: setDataSource failed: status = 0x80000000
at android.media.MediaMetadataRetriever.setDataSource(Native Method)
at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:144)
at com.bumptech.glide.load.resource.bitmap.VideoBitmapDecoder.decode(VideoBitmapDecoder.java:46)
at com.bumptech.glide.load.resource.bitmap.FileDescriptorBitmapDecoder.decode(FileDescriptorBitmapDecoder.java:45)
at com.bumptech.glide.load.resource.bitmap.FileDescriptorBitmapDecoder.decode(FileDescriptorBitmapDecoder.java:19)
at com.bumptech.glide.load.resource.bitmap.ImageVideoBitmapDecoder.decode(ImageVideoBitmapDecoder.java:50)
at com.bumptech.glide.load.resource.bitmap.ImageVideoBitmapDecoder.decode(ImageVideoBitmapDecoder.java:20)
at com.bumptech.glide.load.engine.DecodeJob.decodeFromSourceData(DecodeJob.java:190)
at com.bumptech.glide.load.engine.DecodeJob.decodeSource(DecodeJob.java:177)
at com.bumptech.glide.load.engine.DecodeJob.decodeFromSource(DecodeJob.java:128)
at com.bumptech.glide.load.engine.EngineRunnable.decodeFromSource(EngineRunnable.java:122)
at com.bumptech.glide.load.engine.EngineRunnable.decode(EngineRunnable.java:101)
at com.bumptech.glide.load.engine.EngineRunnable.run(EngineRunnable.java:58)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
at com.bumptech.glide.load.engine.executor.FifoPriorityThreadPoolExecutor$DefaultThreadFactory$1.run(FifoPriorityThreadPoolExecutor.java:118)

Also did verify that path is not empty and load bitmap as

BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;

Constants.loadImageFromStorage(context, messageID, DD_SPLASH_IMG_THUMB_DIR, options);

if (options.outHeight > 0) {
 String ss = "";
}

Here I got options.outHeight value is greater then 0.(Means path is valid and bitmap is there).
Note : also checked issue #415 but this is for empty string. I am using Glide version

compile  'com.github.bumptech.glide:glide:3.6.0'
question

Most helpful comment

Why is this closed? It's clearly not fixed.

All 21 comments

Same issue with 'com.github.bumptech.glide:glide:3.7.0'

Can you please give an example of imgFile.getPath() for which you get this exception? It's weird that it's trying the media store if it's a file path, why not just load the stream/descriptor directly?!

Tips I noticed when reading your code:

  • override is redundant, if the ImageView has fixed sizes in XML (like you assume) it'll be seen by Glide and it won't wait for the layout, just use those numbers because that's your target.
  • I don't think you need that position check in the listener: if the load finished normally than you're OK. If the item view was recycled while the request was in progress, then it the next into call has cleared the request so no listener will be called. Did you get wierd behaviour when you put that there?

I am using file saved from internal memory.

I'm curious about the string's format itself, not the actual path; like first char, special chars and stuff. Actually, since you already have a File, just give it a go without getPath() as that method may give you relative path I think. Also try getAbsolutePath(), but passing the object is the best if you already have it; Glide has many overloads for load().

Please let us know if you figured it out or you can provide an example Uri; it may be helpful if someone finds this while searching for the exception message.

Version: 3.7.0

I'm having the same issue.
Sometimes exception is "setDataSource failed", othertimes "Problem decoding into existing bitmap".
I choose an image from the gallery, then I copy it to applications cache directory and pass just copied file path to Glide.

Glide.with(context).load(new File(image.getFilePath()))
       .placeholder(R.color.while_loading)
       .centerCrop()
       .into(holder.image);

But when I exit the activity and open it once more, Glide loads the image without any errors.

EDIT: Found the problem. It was because sometimes while loading file another process was accessing the image.

happens to me, when loading 6 or more local images at the same time.

 D/GenericRequest: load failed
                            java.lang.RuntimeException: setDataSource failed: status = 0x80000000
                                at android.media.MediaMetadataRetriever.setDataSource(Native Method)
                                at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:144)
                                at com.bumptech.glide.load.resource.bitmap.VideoBitmapDecoder.decode(VideoBitmapDecoder.java:46)
                                at com.bumptech.glide.load.resource.bitmap.FileDescriptorBitmapDecoder.decode(FileDescriptorBitmapDecoder.java:45)
                                at com.bumptech.glide.load.resource.bitmap.FileDescriptorBitmapDecoder.decode(FileDescriptorBitmapDecoder.java:19)
                                at com.bumptech.glide.load.resource.bitmap.ImageVideoBitmapDecoder.decode(ImageVideoBitmapDecoder.java:50)
                                at com.bumptech.glide.load.resource.bitmap.ImageVideoBitmapDecoder.decode(ImageVideoBitmapDecoder.java:20)
                                at com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapperResourceDecoder.decodeBitmapWrapper(GifBitmapWrapperResourceDecoder.java:121)
                                at com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapperResourceDecoder.decode(GifBitmapWrapperResourceDecoder.java:73)
                                at com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapperResourceDecoder.decode(GifBitmapWrapperResourceDecoder.java:61)
                                at com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapperResourceDecoder.decode(GifBitmapWrapperResourceDecoder.java:22)
                                at com.bumptech.glide.load.engine.DecodeJob.decodeFromSourceData(DecodeJob.java:190)
                                at com.bumptech.glide.load.engine.DecodeJob.decodeSource(DecodeJob.java:177)
                                at com.bumptech.glide.load.engine.DecodeJob.decodeFromSource(DecodeJob.java:128)
                                at com.bumptech.glide.load.engine.EngineRunnable.decodeFromSource(EngineRunnable.java:122)
                                at com.bumptech.glide.load.engine.EngineRunnable.decode(EngineRunnable.java:101)
                                at com.bumptech.glide.load.engine.EngineRunnable.run(EngineRunnable.java:58)
                                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
                                at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                at java.lang.Thread.run(Thread.java:818)
                                at com.bumptech.glide.load.engine.executor.FifoPriorityThreadPoolExecutor$DefaultThreadFactory$1.run(FifoPriorityThreadPoolExecutor.java:118)

version 3.7.0

Same here, when trying to load image into future target on background thread.

Hi @TWiStErRob ,

I am getting same issue, and i passed file uri and its uri value is like this,
file:///storage/emulated/0/DCIM/Camera/IMG_20170729_143102.jpg

It not happened for all local images.

here is an error,

05-15 12:44:50.081 20443-20443/com.azova W/Glide: Load failed for file:///storage/emulated/0/DCIM/Camera/IMG_20170729_143102.jpg with size [270x270]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
There were 3 causes:
java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0xFFFFFFEA)
java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0xFFFFFFEA)
java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0xFFFFFFEA)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 3): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{FileInputStream->Object->Drawable}, LOCAL
Cause (1 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->GifDrawable->Drawable}
Cause (2 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->Bitmap->Drawable}
Cause (3 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->BitmapDrawable->Drawable}
Cause (2 of 3): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{ParcelFileDescriptor->Object->Drawable}, LOCAL

Did someone find what was causing that bug ? I'm having the same

Why is this closed? It's clearly not fixed.

Also锛孡oad failed for /storage/emulated/0/UCDownloads/pictures/pic_uc_1561599208786.jpg with size [300x300]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
There were 3 causes:
java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0xFFFFFFEA)
java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0xFFFFFFEA)
java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0xFFFFFFEA)

I think this may be related to permissions. Under which permissions will the Glide code be executed? Under the permissiions of the invoking app or something else?

It seems like this issue is only present in my case if the Android device is connected to a computer. After disconnecting, the error is no longer reproducible (see link above).

Got this on version 4.10.0

Happened for a Uri (content://com.android.externalstorage.documents/document/03E6-1E1E%3ADCIM%2FCamera%2F20190728_075657.jpg). I don't have that file; I got the Uri from a Crashlytics report.

I solved with
.diskCacheStrategy(DiskCacheStrategy.NONE)

Solved by FrancescoSantagati way. Seems like Glide is trying to save an unavailable URL jpeg-resource into disk cache and generates java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0x80000000) on background thread in my case . When I set .diskCacheStrategy(DiskCacheStrategy.NONE) it generates nothing in the stacktrace.

Had the same problem. solved by FrancescoSantagati way too. But now i have a similar problem, i am working with Firebase and after i set.diskCacheStrategy(DiskCacheStrategy.NONE) i got an exception 'Failed to load resource' with no any details, also there is nothing in the stacktrace

Got this error when was solving another error: "javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found".

This happened when an administrator changed a server cetificate. After trying to solve with https://stackoverflow.com/questions/41114569/glide-javax-net-ssl-sslhandshakeexception-java-security-cert-certpathvalidato I got this error.

I solved with
.diskCacheStrategy(DiskCacheStrategy.NONE)

I solved with
.diskCacheStrategy(DiskCacheStrategy.ALL). I think better go with cache

For my case,the reason is empty image file,so I resolved it by redownloading image file.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kenneth2008 picture kenneth2008  路  3Comments

r4m1n picture r4m1n  路  3Comments

sant527 picture sant527  路  3Comments

technoir42 picture technoir42  路  3Comments

MrFuFuFu picture MrFuFuFu  路  3Comments