Sam*_*Sam 14 java android firebase crashlytics firebase-storage
我正在使用Firebase在Android上下载文件.这是我的代码:
try {
//.. Try to download file from Firebase
} catch(StorageException e) {
if(e.getErrorCode() == StorageException.ERROR_RETRY_LIMIT_EXCEEDED) {
//Ignore! Exception has occurred due to no Internet availability
} else {
//Other genuine failure, log it
Crashlytics.logException(e);
}
}
Run Code Online (Sandbox Code Playgroud)
现在,此代码不会发送"已超出操作重试限制".例外.但是,在Crashlytics中,我仍然可以看到报告此异常.
Non-fatal Exception: com.google.firebase.storage.StorageException
The operation retry limit has been exceeded.
Caused by javax.net.ssl.SSLException
Read error: ssl=0x7188e1fe08: I/O error during system call, Software caused connection abort
Run Code Online (Sandbox Code Playgroud)
这怎么可能?我错过了什么吗?
Firebase版本:16.0.1
您的帖子没有显示文件下载的代码。我假设它在Task. 也许异常不会传播到外围try-block,您需要在回调中处理它,如下所示:
storageRef.getFile(contentDir).addOnCompleteListener(
new OnCompleteListener<FileDownloadTask.TaskSnapshot>() {
@Override
public void onComplete(@NonNull Task<FileDownloadTask.TaskSnapshot> task) {
if (task.isSuccessful()) {
...
} else {
StorageException se = (StorageException) task.getException();
if (se.getErrorCode() == StorageException.ERROR_RETRY_LIMIT_EXCEEDED) {
// Ignore
} else {
Crashlytics.logException(se);
}
}
}
});
Run Code Online (Sandbox Code Playgroud)
如果我猜错了您的下载代码,请更新您的帖子以包含它。
| 归档时间: |
|
| 查看次数: |
272 次 |
| 最近记录: |