使用 FirebaseUI 将图像从 Cloud Firestore 直接下载到 imageView

Downloading an image from Cloud Firestore directly into an imageView using FirebaseUI

我是 Firebase 的新手,我刚刚了解了有关实时数据库和云 Firestore 的设置和文档。我正在尝试测试文档的一部分,您可以在其中使用 FirebaseUI 将图像直接下载到 ImageView (reference) 中。这是他们的代码:

// Reference to an image file in Cloud Storage
StorageReference storageReference = FirebaseStorage.getInstance().getReference();

// ImageView in your Activity
ImageView imageView = findViewById(R.id.imageView);

// Download directly from StorageReference using Glide
// (See MyAppGlideModule for Loader registration)
GlideApp.with(this /* context */)
        .load(storageReference)
        .into(imageView);FirebaseUIActivity.java

这是我的代码:

FirebaseStorage storage = FirebaseStorage.getInstance();

StorageReference iconRef = storage.getReferenceFromUrl("https://firebasestorage.googleapis.com/rest_of_the_link");

// ImageView in your Activity
ImageView imageView = findViewById(R.id.iconImageView);

// Download directly from StorageReference using Glide
// (See MyAppGlideModule for Loader registration)
Glide.with(this /* context */)
        .load(iconRef)
        .into(imageView);

}

我在 firestore 中有一个 .webp 图像,我使用 StorageReference iconRef 对其进行了引用,然后尝试将其加载到 ImageView 中。可悲的是,那没有用。我在这里错过了什么?另外,是不是 GlideApp 部分被 Glide 替换了,因为我找不到它?

尝试创建一个名为 GlideApp 的文件(或任何您想要的)作为:

@GlideModule class GlideApp extends AppGlideModule { }

然后使用 GlideApp.with(this /* context */) .load(iconRef) .into(imageView);