Glide not able to load some of images failed with exception

0

I have issue with image loading. Only some of the images are not loading. I have tried using glide and image loader.

Glide code :

Glide.with(context)
                .load(model.getImage4x3().trim()+"?w=430&h=275")
                .into(holder.mBinding.ivPromotion);

Glide dependency :

 implementation 'com.github.bumptech.glide:glide:4.9.0'

I have also tried : 3.9.0 , 4.0.0 , 3.6.1 , 3.8.0

Error :

load failed for http://mcms-uat.mercatus.com.sg/en/-/media/E3BE24B58E1144228C62D2364F4FF543.ashx?rev=50ebbcc572e6488c826a23276ab9bf08 with size [320x240]
    class com.bumptech.glide.load.engine.GlideException: Failed to load resource
    There were 4 causes:
    java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0x80000000)
    java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0x80000000)
    java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0x80000000)
    java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0x80000000)
     call GlideException#logRootCauses(String) for more detail
      Cause (1 of 6): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{DirectByteBuffer->Object->Drawable}, DATA_DISK_CACHE, http://mcms-uat.mercatus.com.sg/en/-/media/E3BE24B58E1144228C62D2364F4FF543.ashx?rev=50ebbcc572e6488c826a23276ab9bf08
        Cause (1 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{DirectByteBuffer->GifDrawable->Drawable}
        Cause (2 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{DirectByteBuffer->Bitmap->Drawable}
        Cause (3 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{DirectByteBuffer->BitmapDrawable->Drawable}

Image :

http://mcms-uat.mercatus.com.sg/en/-/media/E3BE24B58E1144228C62D2364F4FF543.ashx?rev=50ebbcc572e6488c826a23276ab9bf08

Please check!

android
android-glide
android-image
asked on Stack Overflow Jun 20, 2019 by Annie

4 Answers

2

Thank you all of you for your Answers and suggestions. I have resolved the issue. There was problem in my URL parameter it was ?w=430&h=275 instead of &w=430&h=275. Due to this image was not cropped and issue in loading big image, so i resolved it by changing parameters

answered on Stack Overflow Jun 20, 2019 by Annie • edited Mar 23, 2020 by Amir Dora.
1
1) Add below dependencies into app/build.gradle      
    annotationProcessor 'com.github.bumptech.glide:compiler:your_glide_version'

2) put android:largeHeap="true" into tag of manifest file

3) and use like below

    ImageView imageView = (ImageView) findViewById(R.id.my_image_view);
    Glide.with(context)  // this
       .load(imagePath)
       .placeholder(R.drawable.loading_spinner)
       .into(imageView);
answered on Stack Overflow Jun 20, 2019 by Arwy Shelke
1

There is problem with loading large images in glide

Either use Picasso library

implementation 'com.squareup.picasso:picasso:2.5.2'

or you can use facebook library also, available on their website (this will also load gif images well).

answered on Stack Overflow Jun 20, 2019 by Rohit Lalwani
1

Simply Use This Method and You're Done. And if it's not worked, then go with Picasso Library, Because this issue is already STALED by Glide Itself.

 Glide.with(context)
                .asBitmap()
                .load("Your Network Image Path")
                .diskCacheStrategy(DiskCacheStrategy.ALL)
                .into(new CustomTarget<Bitmap>() {
                    @Override
                    public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
                        iv.setImageBitmap(resource);
                        iv.buildDrawingCache();
                    }
                    @Override
                    public void onLoadCleared(@Nullable Drawable placeholder) { }
                });
answered on Stack Overflow Sep 8, 2020 by Ramkesh Yadav • edited Sep 12, 2020 by Ramkesh Yadav

User contributions licensed under CC BY-SA 3.0