毕加索未在 android 中从 firebase url 加载所有图像

picasso not loading all images from firebase url in android

我正在尝试通过 url 从 firebase 存储加载图像,但是所有图像都没有被加载,有些正在加载,有些没有我正在使用下面的代码和 Picasso 库来加载图像

Picasso.get().load(post.getPost_user_profile_pic_url())
                    .resize(200, 200)
                    .centerCrop()
                    .into(postUserImage);

当我尝试如下使用 Glide 库时

Glide.with(itemView.getContext()).load(post.getPost_user_profile_pic_url()).into(postUserImage);

我得到了以下

W

/Glide: Load failed for https://firebasestorage.googleapis.com/............ with size [120x120] class com.bumptech.glide.load.engine.GlideException: Failed to load resource There was 1 cause: java.io.FileNotFoundException(https://firebasestorage.googleapis.com/v0/b/....................) call GlideException#logRootCauses(String) for more detail Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class java.io.InputStream, REMOTE

我如何纠正这个问题以确保所有相应的图像都从 URL 加载?

为了让 Glide 从 URL 加载图像数据,URL 需要 public 可读。由于您希望图像数据受到 Firebase 安全规则的保护,因此您使用的 URL 绝对不是 public.

要将 Firebase 存储与 Glide 集成,您需要将 Firebase 的 API methods to load the data 之一用于流、内存或本地文件。从那里你可以将它传递给 Glide。

我强烈推荐使用 FirebaseUI library that integrates with Glide, either directly in your code, or as an example of how to build such an integration. For the specific code that loads the data from Firebase, see this method in the code