You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Firebase Storage异常:The storage Uri cannot contain a path element

Firebase Storage 抛出异常:The storage Uri cannot contain a path element

之前一直正常运行的代码,昨天突然无征兆抛出如下异常:

The storage Uri cannot contain a path element.

出问题的代码行:

val storageReference = FirebaseStorage.getInstance().getReference(senderRoom.plus("/Media/Picture/".plus(imageName)))

其中imageName的值为 "1695929588446"

我已经尝试了以下几种写法,但都没能解决问题:

  • 仅传入文件名(移除路径),仍报相同异常:
val storageReference = FirebaseStorage.getInstance().getReference(imageName)
  • 改用child()方法拼接路径,依旧无效:
val storageReference = FirebaseStorage.getInstance().getReference().child(senderRoom.plus("/Media/Picture/".plus(imageName)))

当前使用的Firebase Storage依赖版本:

implementation 'com.google.firebase:firebase-storage-ktx:20.0.1'

内容的提问来源于stack exchange,提问作者Jaffar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.09 15:09:57