[英]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.