【发布时间】:2018-09-30 10:39:20
【问题描述】:
我正在尝试将 2680 张图片(总大小 200mb)从我的 Android 手机上传到 Firebase 存储。使用下面的代码,我一次只能上传 130 张图片。一次上传是否有限制,还是我做错了什么?
try {
for (int i=0; i < fileList.length; i++) {
final File currentFile = fileList[i];
FirebaseStorage.getInstance().getReference()
.child("Product Images/" + currentFile.getName() + "." + MimeTypeMap.getFileExtensionFromUrl(currentFile.getPath()))
.putFile(Uri.fromFile(new File(currentFile.getAbsolutePath())))
.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
Log.d("UPLOADCOMPLETED", "onSuccess: " + (currentIterator) +taskSnapshot.getDownloadUrl());
}
});
}
} catch (Exception e) {
Log.d("UPLOADCOMPLETED");
e.printStackTrace();
}
执行到130后,退出循环,执行catch();。 它还会在我的 logcat 中生成 2 个错误:
W/System.err:at com.google.firebase.storage.UploadTask.schedule(Unknown Source:4)
W/System.err:at com.ubuyquick.customer.UploadingImages.ProductUpload.pushToFirebase(ProductUpload.java:77)
【问题讨论】:
标签: android firebase firebase-storage