从Firebase存储加载图像,但使用Glide时出错

问题描述 投票:0回答:1

我试图从Firebase存储加载png图像,但我面临一个奇怪的事情。我在我的项目中使用这个dependency

implementation 'com.firebaseui:firebase-ui-storage:3.2.2'

我的项目有FirebaseRecyclerAdapter来查看Firebase数据库中的列表

请看看这段代码。

 @Override
            protected void onBindViewHolder(@NonNull holder holder, int position, @NonNull List model) {
                // other code that not needed to post

                // Reference to an image file in Cloud Storage
                StorageReference storageReference  = FirebaseStorage.getInstance().getReference().child("thumbnails/Untitled.png");

                Glide.with(context)
                        .using(new FirebaseImageLoader()) //"using()" got a red color
                        .load(storageReference)
                        .into(imageView);
            }

最奇怪的是为什么我在那个区域得到了红色? (使用方法)说

无法解决方法'使用(com.firebase.ui.storage.images.FirebaseImageLoader)'

我一直在谷歌搜索这个问题,但没有运气,没有什么和我的问题一样。

enter image description here

如果我删除这个

.using(new FirebaseImageLoader())

并尝试运行应用程序,它将不会从firebase存储加载图像,我有一个logcat错误

 E/GlideExecutor: Request threw uncaught throwable
                                                                   com.bumptech.glide.Registry$NoModelLoaderAvailableException: Failed to find any ModelLoaders for model: gs://sdakaraoke.appspot.com/thumbnails/Untitled.png
                                                                       at com.bumptech.glide.Registry.getModelLoaders(Registry.java:584)
                                                                       at com.bumptech.glide.load.engine.DecodeHelper.getLoadData(DecodeHelper.java:205)
                                                                       at com.bumptech.glide.load.engine.DecodeHelper.getCacheKeys(DecodeHelper.java:223)
                                                                       at com.bumptech.glide.load.engine.ResourceCacheGenerator.startNext(ResourceCacheGenerator.java:42)
                                                                       at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:299)
                                                                       at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:266)
                                                                       at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:230)
                                                                       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1115)
                                                                       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:590)
                                                                       at java.lang.Thread.run(Thread.java:818)
                                                                       at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:446)
android firebase firebase-storage android-glide
1个回答
1
投票

将'com.firebaseui:firebase-ui-storage:'从0.6.0更改为3.2.2

© www.soinside.com 2019 - 2024. All rights reserved.