在E/StorageException中恢复UploadTask结果:BufferedInputStream已关闭 [英] Resuming UploadTask results in E/StorageException: BufferedInputStream is closed

查看:74
本文介绍了在E/StorageException中恢复UploadTask结果:BufferedInputStream已关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法从暂停状态恢复UploadTask.如果我让视频结束播放而没有尝试暂停上传,则可以成功上传该视频.根据 Firebase Storage Android文档,您可以使用函数以恢复先前暂停的UploadTask.不幸的是,当我尝试自己执行示例时,观察到

I am having trouble resuming an UploadTask from the paused state. I am able to successfully upload a video if I let it finish without attempting to pause the upload. According to Firebase Storage Android Documentation you can use the resume function to resume an UploadTask that was paused previously. Unfortunately when I try and execute the sample myself, I observe a

04-11 15:20:36.285 9432-9660/io.pristine.firebasesample E/UploadTask:无法读取要上传的字节 java.io.IOException:流关闭 在java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:162) 在java.io.BufferedInputStream.read(BufferedInputStream.java:325) 在com.google.android.gms.internal.zzbtu.zzqP(未知来源) 位于com.google.firebase.storage.UploadTask.zzacR(未知来源) 位于com.google.firebase.storage.UploadTask.run(未知来源) com.google.firebase.storage.StorageTask $ 8.run(未知源) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:607) 在java.lang.Thread.run(Thread.java:761)

04-11 15:20:36.285 9432-9660/io.pristine.firebasesample E/UploadTask: Unable to read bytes for uploading java.io.IOException: Stream closed at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:162) at java.io.BufferedInputStream.read(BufferedInputStream.java:325) at com.google.android.gms.internal.zzbtu.zzqP(Unknown Source) at com.google.firebase.storage.UploadTask.zzacR(Unknown Source) at com.google.firebase.storage.UploadTask.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)

然后是另一个:

04-11 15:20:36.285 9432-9660/io.pristine.firebasesample E/StorageException:发生StorageException. 发生未知错误,请检查HTTP结果代码和服务器响应的内部异常. 代码:-13000 Http结果:200

04-11 15:20:36.285 9432-9660/io.pristine.firebasesample E/StorageException: StorageException has occurred. An unknown error occurred, please check the HTTP result code and inner exception for server response. Code: -13000 HttpResult: 200

HttpResult 200似乎正常,并且 -13000看起来像ERROR_UNKNOWN

HttpResult 200 seems normal and -13000 looks like ERROR_UNKNOWN

我已经上传了一个非常简单的android项目来重现该错误-只需创建一个FirebaseStorage帐户并将google-services.json文件拖放到您的项目中,然后设置用户名和密码

在github存储库出现故障的情况下要重现的基本步骤:

Basic steps to reproduce in case the github repo goes down:

  1. 使用Firebase身份验证进行身份验证(不确定是否需要这样做)
  2. 从资产中复制一个二进制文件(如果需要,您可以从SD卡中读取)
  3. 使用putFile(Uri,StorageMetadata)启动UploadTask
  4. 在上传开始之后和结束之前,通过调用UploadTask.pause()暂停uploadTask
  5. 通过调用UploadTask.resume()确认暂停后,可以在一两秒钟内恢复上传任务.
  6. 观察存储异常

我正在使用firebase-database:10.2.1firebase-auth:10.2.1& firebase-storage:10.2.1作为唯一的依赖项,并在支持Google Play服务的多台设备上进行了测试. (Google Play Availability: SUCCESS)

I'm using firebase-database:10.2.1, firebase-auth:10.2.1 & firebase-storage:10.2.1 as the only dependencies, and tested on several devices with google play services support. (Google Play Availability: SUCCESS)

启用此功能的目的是允许应用程序的用户手动暂停和继续上载. (有些位于经过测量的wi-fi热点上,而我所知道的android操作系统不可见)

The goal of getting this feature to work is to allow users of the application to manually pause and resume uploads. (Some are on wi-fi hotspots that are metered and not visible to the android OS that i'm aware of)

推荐答案

Firebaser此处

该错误已在不久前修复,但该修复尚未在客户端库中进行.请在SDK的下一版本中查找更新.如果仍然有问题,请在此处评论.

That bug was fixed a while ago, but the fix has not made it to the client library. Please look for an update in the next version of the SDK. If you are still having problems, please comment back here.

这篇关于在E/StorageException中恢复UploadTask结果:BufferedInputStream已关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆