【发布时间】:2017-07-18 03:07:38
【问题描述】:
尝试加载具有类似 URL 的图片
"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 等来加载图像。我在 Kotlin 中的代码,我添加了编译器依赖项,如下所示
//image loader
compile 'com.github.bumptech.glide:glide:4.0.0-RC1'
kapt 'com.github.bumptech.glide:compiler:4.0.0-RC1'
这就是我如何称呼 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)
}
}
我曾尝试附加一个监听器来查看日志,当 Glide 尝试加载图像时发生了什么,但我只看到“加载资源失败”没有任何用处
【问题讨论】:
-
可能与这个问题有关,github.com/bumptech/glide/issues/2039
-
检查你是否在 for 循环中加载了正确的索引和值
-
@Nithinlal,绝对确定它是正确的,正如第一条评论所说,它确实与那个问题有关。
-
你试过像毕加索这样的另一个图书馆吗?除此之外,可能与stackoverflow.com/questions/45156802/…有关
标签: android kotlin android-glide