Glide cannot load server image url
11,504
Solution 1
it's working with me :
Glide.with(itemView.context)
.load(new URL(v.downloadPath))
.into(image);
Solution 2
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)
Solution 3
Your url should not contain space at start and end, even if their is any chances trim your url.
Author by
Dennis Zinkovski
Updated on July 18, 2022Comments
-
Dennis Zinkovski almost 2 years
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
-
Troy Witthoeft almost 7 yearsThis may be the answer. Would you mind expanding this with some context? Why does this work instead of OP's code? When future visitors land on your answer the will have an explanation of why it works. Thanks.