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

如何通过Firebase CLI或curl下载App Distribution的apk/ipa安装包?

使用Firebase CLI或curl获取App Distribution的安装包(APK/IPA)

用Firebase CLI直接下载

这是最简便的方式,步骤如下:

  • 先确保已安装Firebase CLI并完成登录:firebase login
  • 用appdistribution:distributions:download命令下载指定版本,需传入关键参数:
    • --app:你的应用ID(Firebase控制台应用设置中可查)
    • --release:目标发布的版本号或发布ID
    • --output:本地保存路径及文件名
      示例命令:
    firebase appdistribution:distributions:download --app 1:123456789:android:abc123 --release 1.0.0 --output ./test-app.apk
    
  • 若不清楚发布ID,先运行firebase appdistribution:distributions:list --app <你的APP_ID>,即可列出所有已发布版本及对应ID。

用curl结合Firebase API下载

适合集成到自动化脚本中,步骤如下:

  1. 获取访问令牌

    • 在Firebase控制台「设置」→「服务账号」页面生成并下载私钥JSON文件
    • 用gcloud工具激活服务账号并获取令牌:
      gcloud auth activate-service-account --key-file=./your-service-account.json
      gcloud auth application-default print-access-token
      
  2. 获取安装包下载链接
    调用API列出目标应用的所有发布版本,找到对应版本的binaryDownloadUri:

    curl -H "Authorization: Bearer <你的访问令牌>" \
      "https://firebaseappdistribution.googleapis.com/v1/projects/<你的项目ID>/apps/<你的APP_ID>/distributions"
    

    或直接指定发布ID查询详情:

    curl -H "Authorization: Bearer <你的访问令牌>" \
      "https://firebaseappdistribution.googleapis.com/v1/projects/<你的项目ID>/apps/<你的APP_ID>/distributions/<发布ID>"
    
  3. 下载安装包
    拿到binaryDownloadUri后,直接用curl下载:

    curl -H "Authorization: Bearer <你的访问令牌>" -o ./test-app.apk <binaryDownloadUri>
    

注意事项

  • 操作账号(CLI登录账号或服务账号)需拥有Firebase App Distribution的「查看者」或「管理员」权限
  • iOS的IPA包下载流程完全一致,只需将输出文件名改为.ipa即可

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.15 02:35:19