【问题标题】:Firebase Glide not displaying imageFirebase Glide 不显示图像
【发布时间】:2018-10-29 02:10:26
【问题描述】:

搜索了很多网站,我还没有找到答案。

图片不是从 Firebase 上传的,老实说,我不知道它可能是什么。

提前致谢。

代码:

spaceRef = storageRef.child("Users/" + user.getEmail().toString() + "/images/Countries/Spain" /*+ chosenCountry*/);

            Glide.with(ActPhotoViewing.this.getApplicationContext())
                    .load(spaceRef)
                    .into(showImg);

.gradle 中的实现

implementation 'com.firebaseui:firebase-ui-storage:3.2.1'
implementation 'com.github.bumptech.glide:glide:4.4.0'

【问题讨论】:

  • 先尝试从浏览器访问您的图片...以确保其已上线
  • 是的,代码一定有问题。你能看出哪里不对吗?
  • spaceRef 保存路径确保路径正确,如果不是,则在浏览器中访问它,然后代码问题
  • 如果有任何错误消息,请参阅 logcat
  • 使用 getDownloadUrl() 方法获取 uri 并将该 uri 传递到 Glide.load()

标签: java android firebase firebase-storage android-glide


【解决方案1】:

使用 FirebaseUI 时,您需要使用生成的 API。当你构建你的项目时,它应该生成一个 GlideApp 类,你将使用它来代替你的 Glide 静态调用。

试试:

    GlideApp.with(ActPhotoViewing.this.getApplicationContext())
            .load(spaceRef)
            .into(showImg);

如果您收到未找到 GlideApp 的错误,请确保您按照此处的说明进行操作 https://github.com/firebase/FirebaseUI-Android/tree/master/storage。然后清理/重建您的项目。

【讨论】:

    猜你喜欢
    • 2017-10-11
    • 2020-11-20
    • 1970-01-01
    • 2018-08-13
    • 1970-01-01
    • 2018-11-21
    • 1970-01-01
    • 2019-03-09
    • 1970-01-01
    相关资源
    最近更新 更多