Firebase 存储无法下载适用于 Android OS 16 的文件
Posted
技术标签:
【中文标题】Firebase 存储无法下载适用于 Android OS 16 的文件【英文标题】:Firebase storage fails to download file for Android OS 16 【发布时间】:2018-10-25 04:57:16 【问题描述】:我有一个从 Firebase 存储下载文件的 android 应用,它在 Android API 级别 23 及更高级别上运行良好。但是,对于像 Android API 级别 16 这样的版本,它会失败并出现以下异常:
05-15 16:42:32.921 3909-3952/com.X.Y E/StorageException: StorageException has occurred.
An unknown error occurred, please check the HTTP result code and inner exception for server response.
Code: -13000 HttpResult: 0
Unable to open stream
java.io.IOException: Unable to open stream
at com.google.firebase.storage.StreamDownloadTask$zza.zzp(Unknown Source)
at com.google.firebase.storage.StreamDownloadTask$zza.zza(Unknown Source)
at com.google.firebase.storage.StreamDownloadTask.run(Unknown Source)
at com.google.firebase.storage.StorageTask.zzl(Unknown Source)
at com.google.firebase.storage.zzq.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
Caused by: android.os.RemoteException
at com.google.android.gms.internal.firebase_storage.zzp.<init>(Unknown Source)
at com.google.android.gms.internal.firebase_storage.zzp.zzb(Unknown Source)
at com.google.firebase.storage.StorageReference.zzd(Unknown Source)
at com.google.firebase.storage.StreamDownloadTask.zzn(Unknown Source)
at com.google.firebase.storage.StreamDownloadTask.zza(Unknown Source)
at com.google.firebase.storage.zzw.call(Unknown Source)
at com.google.firebase.storage.StreamDownloadTask$zza.zzp(Unknown Source)
at com.google.firebase.storage.StreamDownloadTask$zza.zza(Unknown Source)
at com.google.firebase.storage.StreamDownloadTask.run(Unknown Source)
at com.google.firebase.storage.StorageTask.zzl(Unknown Source)
at com.google.firebase.storage.zzq.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
要下载的代码:
final StorageReference pathReference = mStoragePath.getReference().child(mRootPath + inPath);
final StreamDownloadTask downloadTask = pathReference.getStream();
依赖关系:
com.google.firebase:firebase-core:15.0.2
com.google.firebase:firebase-firestore:16.0.0
com.google.firebase:firebase-storage:15.0.2
【问题讨论】:
firebase 依赖版本? com.google.firebase:firebase-core:15.0.2 和 com.google.firebase:firebase-firestore:16.0.0 和 com.google.firebase:firebase-storage:15.0.2 【参考方案1】:如果您的手机上没有更新 google play 服务,则可能会发生这种情况。确保您拥有最新版本。
如果您的版本是最新的,请在 setContentLanguage 中检查您应该只使用 2 个字母(例如“en”)。你也应该在 github 中检查这个answer,这取决于你的问题
【讨论】:
@Sameer Thigale 这个答案对你有帮助吗?以上是关于Firebase 存储无法下载适用于 Android OS 16 的文件的主要内容,如果未能解决你的问题,请参考以下文章
无法在 Firebase Firestore 中存储下载 URL