2017-07-18 76 views
2

试图加载具有相似的网址相似图片滑翔无法加载服务器映像网址

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

但滑翔显示日志

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 

上一页日志

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 

我无法理解为什么我应该添加AppGlideModule等来加载图像。我在科特林代码,我增加了编译器的依赖性如下

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

这里是我叫滑翔

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) 
    } 
} 

我曾试图附加一个侦听器来查看日志,当滑翔尝试加载发生了什么图像,但我只看到“无法加载资源”没什么

+0

也许与这个问题有关,https://github.com/bumptech/glide/issues/2039 –

+0

检查你是否在for循环中加载了正确的索引和值 – Nithinlal

+0

@Nithinlal,肯定是正确的,就像第一条评论,它是真的与这个问题有关。 –

回答

0

它的工作有用我:

Glide.with(itemView.context) 
    .load(new URL(v.downloadPath)) 
    .into(image); 
+1

有关。这可能是答案。你介意在某种情况下扩展它吗?为什么这个工作而不是OP的代码?当未来的访客登陆你的答案时,会有解释为什么它会起作用。谢谢。 –