尝试加载类似以下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"
但 Glide 显示日志
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在尝试加载图像时发生了什么,但是我只看到“未能加载资源”,没有有用的信息。