Firebase存储无法下载Android OS 16的文件

时间:2018-05-15 11:16:26

标签: android firebase firebase-storage

我有一个从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

1 个答案:

答案 0 :(得分:-1)

如果您的手机上没有更新Google Play服务,则可能会发生这种情况。确保您拥有最新版本。

如果您的版本是最新的,请检查setContentLanguage,您应该只使用2个字母(例如&#34; en&#34;)。你也应该在github中检查这个answer,这取决于你的问题