我有一个Firebase应用。没有毕加索我想加载上传的图像。 我找到了下一个解决方案:
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);
当我尝试使用它时:
以下是我的Firebase存储网址:gs://teszt-cd548.appspot.com
我创建了一个images
文件夹并上传了cross.png
图片。
存储地点
gs://teszt-cd548.appspot.com/images/cross.png
当我尝试在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);
这是我的规则:
service firebase.storage {
match /b/teszt-cd548.appspot.com/o {
match /{allPaths=**} {
allow read;
allow write: if request.auth != null;
}
}
}
我在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)
有人知道这个错误吗?
我希望有人可以帮助我! 非常感谢!
答案 0 :(得分:1)
我遇到了同样的错误,因为您的Google Play服务已过时,我的解决方案是使用真正更新的设备,您可以参考此question找到解决问题的更多方法,更好的解释。