0
我有一個Firebase應用程序。沒有畢加索,我想加載上傳的圖像。 我找到了一個解決方案:Firebase Android將圖像從存儲加載到ImageView
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);
當我嘗試使用它:
這裏是我的火力地堡存儲網址: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)
任何人都有這個錯誤的想法嗎?
我希望有人能幫助我! 非常感謝!