【发布时间】:2017-05-05 01:25:26
【问题描述】:
我正在使用 Firebase 存储、Firebase 数据库 和 Picasso,但我遇到了问题。
我的应用将图像上传到 Firebase 存储,然后将 图像下载网址(使用 taskSnapshot.getDownloadUrl().toString())保存在 Firebase 数据库中。
网址如下所示:
"https://firebasestorage.googleapis.com/v0/b/<my-storage-name>.appspot.com/o/Photos%2F40?alt=media&token=<my-token>"
我正在使用 Picasso 接收此链接(var link):
Picasso.with(MainActivity.this).load(link).into(imageView);
我已验证该脚本可以与其他图片网址一起正常工作,但不适用于 Firebase 存储网址。请帮忙
更新
我补充说:
Picasso.with(MainActivity.this).setLoggingEnabled(true);
这是 Android 监视器日志,第一张图片是我的 Facebook 个人资料图片,并且有效:
12-19 23:11:20.279 8710-8710/com.example.john.finality D/Picasso: Main created [R8] Request{https://scontent.xx.fbcdn.net/v/t1.0-1/p100x100/1465305_691312327560317_1869531162_n.jpg?oh=e86c935ff4945a4573cf75874a095150&oe=58D2344F}
12-19 23:11:20.281 8710-8710/com.example.john.finality D/Picasso: Main completed [R8] from MEMORY
12-19 23:11:20.281 8710-8710/com.example.john.finality D/Picasso: Main created [R9] Request{https://firebasestorage.googleapis.com/v0/b/<my-storage-name>.appspot.com/o/Photos%2F45?alt=media&token=affebbe7-5a8a-4fc1-bf44-bbb2f971cc01 resize(350,350)}
12-19 23:11:20.282 8710-8952/com.example.john.finality D/Picasso: Dispatcher enqueued [R9]+0ms
12-19 23:11:20.282 8710-8974/com.example.john.finality D/Picasso: Hunter executing [R9]+0ms
12-19 23:11:22.421 8710-8952/com.example.john.finality D/Picasso: Dispatcher retrying [R9]+2140ms
12-19 23:11:22.422 8710-8973/com.example.john.finality D/Picasso: Hunter executing [R9]+2140ms
12-19 23:11:23.525 8710-8952/com.example.john.finality D/Picasso: Dispatcher retrying [R9]+3243ms
12-19 23:11:23.526 8710-8976/com.example.john.finality D/Picasso: Hunter executing [R9]+3244ms
12-19 23:11:23.538 8710-8952/com.example.john.finality D/Picasso: Dispatcher batched [R9]+3257ms for error
12-19 23:11:23.771 8710-8952/com.example.john.finality D/Picasso: Dispatcher delivered [R9]+3489ms
12-19 23:11:23.771 8710-8710/com.example.john.finality D/Picasso: Main errored [R9]+3489ms
【问题讨论】:
-
尝试将监听器放在上面并捕获您遇到的异常并告诉我们。
-
检查您的存储规则。确保您有足够的权限读取存储区域中的文件。
-
如果将 URL 粘贴到浏览器窗口会发生什么?如果那不显示图像,毕加索也不会这样做。
-
嗨朋友们,感谢您的帮助@UMESH0492 检查我的帖子更新
-
@ic90 规则很好,公开
标签: android firebase firebase-realtime-database picasso firebase-storage