Search code examples
androidkotlinandroid-glide

Glide doesn't load image into imageView inside RecyclerView


I'm trying to load image into imageView inside my RecylerView, but i get error. Here is my Glide code:

val imageStringAddress = review.userImage //URL
            val options: RequestOptions = RequestOptions()
                .centerCrop()
                .placeholder(R.drawable.dota_logo) //placeholder
                .error(R.drawable.ic_baseline_star_24) //error image
Glide.with(this.context).load(imageStringAddress).apply(options).into(userIconImage); //load context with URL variable into imageView holder variable (userIconImage)

First, placeholder has loaded, but after 1 second it changes into error "star drawable".

I tried this construction from another StackOverFlow question (class com.bumptech.glide.load.engine.GlideException: Failed to load resource), but it doesn't work too :

         Glide.with(this.context).load(imageStringAddress).apply(options)
                .override(com.bumptech.glide.request.target.Target.SIZE_ORIGINAL, com.bumptech.glide.request.target.Target.SIZE_ORIGINAL).listener(
                    object : RequestListener<Drawable> {
                        override fun onLoadFailed(
                            e: GlideException?,
                            model: Any?,
                            target: com.bumptech.glide.request.target.Target<Drawable>?,
                            isFirstResource: Boolean
                        ): Boolean {
                            return false
                        }

                        override fun onResourceReady(
                            resource: Drawable?,
                            model: Any?,
                            target: com.bumptech.glide.request.target.Target<Drawable>?,
                            dataSource: DataSource?,
                            isFirstResource: Boolean
                        ): Boolean {
                            return false
                        }

                    }
                ).into(userIconImage)

How can i fix it?

Logs:

2022-07-29 21:08:29.454 11232-11269/com.sirius.test_app D/skia: --- Failed to create image decoder with message 'unimplemented'
2022-07-29 21:08:29.456 11232-11269/com.sirius.test_app I/chatty: uid=10154(com.sirius.test_app) glide-source-th identical 4 lines
2022-07-29 21:08:29.457 11232-11269/com.sirius.test_app D/skia: --- Failed to create image decoder with message 'unimplemented'
2022-07-29 21:08:29.469 11232-11232/com.sirius.test_app W/Glide: Load failed for https://ibb.co/WcJMjSw with size [99x99]
    class com.bumptech.glide.load.engine.GlideException: Failed to load resource
    There were 8 root causes:
    java.lang.RuntimeException(setDataSourceCallback failed: status = 0x80000000)
    java.lang.RuntimeException(setDataSourceCallback failed: status = 0x80000000)
    java.lang.RuntimeException(setDataSource failed: status = 0x80000000)
    java.lang.RuntimeException(setDataSource failed: status = 0x80000000)
    java.lang.RuntimeException(setDataSourceCallback failed: status = 0x80000000)
    java.lang.RuntimeException(setDataSourceCallback failed: status = 0x80000000)
    java.lang.RuntimeException(setDataSource failed: status = 0x80000000)
    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, https://ibb.co/WcJMjSw
    There were 2 root causes:
    java.lang.RuntimeException(setDataSourceCallback failed: status = 0x80000000)
    java.lang.RuntimeException(setDataSourceCallback failed: status = 0x80000000)
     call GlideException#logRootCauses(String) for more detail
        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->BitmapDrawable}
    There was 1 root cause:
    java.lang.RuntimeException(setDataSourceCallback failed: status = 0x80000000)
     call GlideException#logRootCauses(String) for more detail
          Cause (1 of 1): class java.lang.RuntimeException: setDataSourceCallback failed: status = 0x80000000
        Cause (3 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{DirectByteBuffer->BitmapDrawable->Drawable}
    There was 1 root cause:
    java.lang.RuntimeException(setDataSourceCallback failed: status = 0x80000000)
     call GlideException#logRootCauses(String) for more detail
          Cause (1 of 1): class java.lang.RuntimeException: setDataSourceCallback failed: status = 0x80000000
      Cause (2 of 6): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{FileInputStream->Object->Drawable}, DATA_DISK_CACHE, https://ibb.co/WcJMjSw
        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->BitmapDrawable}
        Cause (3 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->BitmapDrawable->Drawable}
      Cause (3 of 6): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{ParcelFileDescriptor->Object->Drawable}, DATA_DISK_CACHE, https://ibb.co/WcJMjSw
    There were 2 root causes:
    java.lang.RuntimeException(setDataSource failed: status = 0x80000000)
    java.lang.RuntimeException(setDataSource failed: status = 0x80000000)
     call GlideException#logRootCauses(String) for more detail
        Cause (1 of 2): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{ParcelFileDescriptor->Bitmap->BitmapDrawable}

Solution

  • The issue was in initial data, the URL has navigated to the page with photo, not the image URL itself. URL in DataModel: "https://ibb.co/WcJMjSw" URL to image: "https://i.ibb.co/55HSwqy/img-user-1.png" Special thanks to Ajithkumar Muthukumaran!