Glide cannot load server image url

Viewed 11793

Trying to load images with similar URLs like this

"https://firebasestorage.googleapis.com/v0/b/content-office-e1931.appspot.com/o/usersData%2Fposts%2Fmedia_-KpGAURJbB33BKhTynV1?alt=media&token=26135949-a918-4572-9293-b639d43f04aa"

But glide shows logs

Load failed for  with size [360x360]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
class com.bumptech.glide.load.engine.GlideException: Failed to load resource

Previous logs

Failed to find GeneratedAppGlideModule. You should include an annotationProcessor 
compile dependency on com.github.bumptech.glide:glide:compiler in your application 
and a @GlideModule annotated AppGlideModule implementation or LibraryGlideModules 
will be silently ignored

I can't understand why I should add AppGlideModule and etc just to load images. My code in Kotlin, I have added compiler dependency as below

 //image loader
compile 'com.github.bumptech.glide:glide:4.0.0-RC1'
kapt 'com.github.bumptech.glide:compiler:4.0.0-RC1'

Here is how I call Glide

 fun bind(post: Post) {
    for ((k, v) in post.media) {
        Glide.with(itemView.context)
                .asBitmap()
                .apply(RequestOptions.encodeQualityOf(70))
                .apply(RequestOptions.overrideOf(width,width))
                .apply(RequestOptions.centerCropTransform())
                .load(v.downloadPath)
                .into(image)
    }
}

I had tried attach a listener to see logs, what is happening when Glide tries to load image but I see only "Failed to load resource" nothing useful

5 Answers

I don't know is this solution going work for everyone but in my case it worked !

<application
    android:usesCleartextTraffic="true"


</application>

and try to load your image in this format

Glide.with(context)
.load(new URL(your_image))
.into(image)

Your url should not contain space at start and end, even if their is any chances trim your url.

Your image source URL is incorrect, please make sure it correct by the way check it using the browser.

Simply Use This Strategy and You're Done.

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) { }
            });
Related