请求图像时FirebaseStorage返回未知错误 [英] FirebaseStorage returning unknown error when requesting image

查看:70
本文介绍了请求图像时FirebaseStorage返回未知错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试提取已添加到Android设备上的Firebase存储中的图像.每次运行时,我都会从onFailureListener()

I am trying to pull in an image I have added to my firebase storage on an Android device. Every time this runs I get this error from the onFailureListener()

E/StorageException(9646):发生未知错误,请检查HTTP结果代码和服务器响应的内部异常. E/StorageException(9646):代码:-13000 HttpResult:0

E/StorageException(9646): An unknown error occurred, please check the HTTP result code and inner exception for server response. E/StorageException(9646): Code: -13000 HttpResult: 0

我还暂时更改了存储权限以进行读写,以确保这不是问题.

I have also changed the permissions on storage to have read/write for the time being to make sure that isn't the problem.

final ImageView test = (ImageView) findViewById(R.id.test_image);
StorageReference ref = storage.getReferenceFromUrl("gs://my-project.appspot.com/test_image.png");
    ref.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
        @Override
        public void onSuccess(Uri uri) {
            Log.d(TAG, "Successfully loaded uri");
            test.setImageURI(uri);
        }
    }).addOnFailureListener(new OnFailureListener() {
        @Override
        public void onFailure(@NonNull Exception e) {
            Log.d(TAG, "Failed loaded uri: " + e.getMessage());
        }
    });

推荐答案

我刚刚注意到httpresult为零.这表明从未提出过获取下载网址的请求.发生这种情况的一种方法是,如果未在手机上更新播放服务.您将知道这是错误,因为adb logcat将显示错误,并带有无法加载存储网络层"的效果.

I just noticed that the httpresult is zero. This suggests the request to get the download url was never made. One way this can happen is if play services isn't updated on your phone. You will know this is the error because adb logcat will show an error with something to the effect of "Storage network layer could not be loaded".

要解决此问题,请更新手机上的播放服务.有几种方法可以做到这一点.我发现最简单的方法是安装应用程序播放服务信息"以在播放商店中查看播放服务,然后在可用的情况下点击更新.

To fix this, update play services on your phone. There are a few ways of doing this. I find the easiest is to install the app "play services info" to see play services in the play store, and then hit update if its available.

这篇关于请求图像时FirebaseStorage返回未知错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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