skip to Main Content

in my application when i use real device every thing working as expected and the images is loaded successfully using glide but in emulator all the images fail to load.

here is what i tried:

check internet connection

try emulator with sdk 28 and 30

one of the images that i load:
https://trueexpress-s3.s3.us-east-2.amazonaws.com/small_21305742044_air_freshener_liquid_beads_from_air_fresh_224849_7128b27d67.jpg

here is how i load images with glide:

@BindingAdapter("imageUrl")
fun ImageView.setImageUrl(url: String?) {
    if (url == null) {
        setImageBitmap(null)
        return
    }
    GlideApp.with(this)
        .load(url).into(this)
}

Screen shots:

enter image description here

enter image description here

EDIT MY LOGS:

2021-08-26 09:14:45.045 5274-5274/com.trends.trueexpress.debug W/Glide: Load failed for https://trueexpress-s3.s3.us-east-2.amazonaws.com/Untitled_1_copy_a514f5ee8a.jpg with size [532x300]
    class com.bumptech.glide.load.engine.GlideException: Failed to load resource

2

Answers


  1. add the code for glide section.

    post the image url. hope image url is https not http.

    try the below code and check for exception.

    Glide.with(context).
            load(url)
            .listener(new RequestListener<String, GlideDrawable>() {
                @Override
                public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
                    progressBar.setVisibility(View.GONE);
                    return false;
                }
    
                @Override
                public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
                    progressBar.setVisibility(View.GONE);
                    return false;
                }
            })
            .crossFade(1000)
            .into(imageView);
    
    Login or Signup to reply.
  2. Have you added internet permission in manifest file?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search