简体   繁体   English

Firebase Android将图像从存储加载到ImageView

[英]Firebase Android Load image to ImageView from storage

I have a Firebase app. 我有一个Firebase应用程序。 Without picasso i want to load uploaded images. 没有毕加索,我想加载上传的图像。 I found the next solution: 我找到了下一个解决方案:

dependencies {
    // FirebaseUI Storage only
    compile 'com.firebaseui:firebase-ui-storage:0.6.0'
}
// Reference to an image file in Firebase Storage
StorageReference storageReference = ...;

// ImageView in your Activity
ImageView imageView = ...;

// Load the image using Glide
Glide.with(this /* context */)
        .using(new FirebaseImageLoader())
        .load(storageReference)
        .into(imageView);

When i try to use it: 当我尝试使用它时:

Here is my Firebase Storage URL: gs://teszt-cd548.appspot.com I created an images folder and uploaded cross.png image. 这是我的Firebase存储URL: gs://teszt-cd548.appspot.com我创建了一个images文件夹并上传了cross.png图像。

Storage location 存储位置

gs://teszt-cd548.appspot.com/images/cross.png

When i try to load it on android: 当我尝试将其加载到android上时:

FirebaseStorage storage = FirebaseStorage.getInstance();
StorageReference storageRef = storage.getReferenceFromUrl("gs://teszt-cd548.appspot.com");
StorageReference pathReference = storageRef.child("images/cross.png");

Glide.with(context)
       .using(new FirebaseImageLoader())
       .load(pathReference)
       .into(iv);

Here is my rule: 这是我的规则:

  service firebase.storage {
  match /b/teszt-cd548.appspot.com/o {
    match /{allPaths=**} {
       allow read;
       allow write: if request.auth != null;
    }
  }
}

I got the next error message on android: 我在android上收到了下一条错误消息:

StorageException has occurred.
An unknown error occurred, please check the HTTP result code and inner exception for server response.
Code: -13000 HttpResult: 0
01-14 18:42:46.104 31019-31093/com.app.myapplication E/StorageException: null
                    android.os.RemoteException
                        at com.google.android.gms.internal.zzbre.<init>(Unknown Source)
                        at com.google.android.gms.internal.zzbre.zzj(Unknown Source)
                        at com.google.firebase.storage.StorageReference.zzaaN(Unknown Source)
                        at com.google.firebase.storage.StreamDownloadTask.run(Unknown Source)
                        at com.google.firebase.storage.StorageTask$8.run(Unknown Source)
                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
                        at java.lang.Thread.run(Thread.java:761)

Anyone have idea about this error? 有人对此错误有想法吗?

I hope someone can help me! 我希望有一个人可以帮助我! Thanks so much! 非常感谢!

我也遇到了同样的错误,这是因为您的Google Play服务已经过时了,我的解决方案是使用真正的更新设备,您可以参考此问题以找到更多解决问题的方法和更好的解释。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android:将存储中的大图像加载到ImageView中 - Android: Load large image from storage into ImageView 无法将图像从ImageView上传到Android中的FireBase存储 - Unable to upload image from an ImageView to FireBase Storage in Android 从 Firebase 存储下载图像到 imageview 上 android 工作室 Z93F725A07423FE2189F448B336 - Downloading image from Firebase storage into imageview on android studio java Android Glide和Firebase存储:将连续图像从Firebase存储加载到Imageview-闪烁 - Android Glide and Firebase Storage: Load Consecutive Images from Firebase Storage to Imageview - Flickering 无法将图片从 Firebase 存储加载到 Imageview - Cant load picture from Firebase Storage to an Imageview 无法从Firebase存储在ImageView中显示图像 - Unable to Show Image In ImageView From Firebase Storage 无法从内部存储器将图像加载到ImageView中 - Unable to load image in a ImageView from the Internal Storage 将Picasa从Firebase存储中的图像加载到Infowindow中的ImageView中,Picasso仅显示占位符 - Load Image from Firebase Storage with Picasso to ImageView in Infowindow, Picasso only shows placeholder 在Firebase数据库的Imageview中显示存储在Firebase存储中的图像 - Show the image stored in Firebase storage in Imageview from Firebase Database 尝试将Firebase存储映像设置为ImageView Android时出现问题 - Problem occurs while trying to set Firebase storage image into ImageView Android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM