Firebase 2.0 - 如何处理Android应用程序的多种风味(环境)? [英] Firebase 2.0 - how to deal with multiple flavors (environments) of an android app?

查看:197
本文介绍了Firebase 2.0 - 如何处理Android应用程序的多种风味(环境)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的应用程序的多种口味。我应该如何设置这个服务器端?我的软件包名称是:

code> com.example.app (production)
com.example.app.staging (staging)
com.example.app.fake (假)



这应该是Firebase控制台中的3个独立项目吗? 关于你希望你的项目如何工作。您可以在同一个控制台中设置所有三个,也可以将其设置为两个或更多不同的项目。这两个选项都是有效的。



同一项目的好处:


  • 分享相同的结算,配额,权限,和服务(数据库,存储,FCM等)。
  • 与生产相同的环境



不同项目的好处:


  • 没有覆盖生产数据或影响生产用户的风险。



如果使用多个项目,则可以利用构建类型的支持,这将允许你有不同的版本不同的 google-services.json 文件。如果使用一个项目,相同的 google-services.json 将适用于所有类型。注意:正如CodyMace在评论中所说的那样 - 记得每次添加一个应用程序时都要重新下载JSON文件!




$ b $在这两种情况下,你都可以做一些事情来降低风险(比如在你的数据库中有dev / stage / prod / keys,下面有类似的结构),但是对你来说有意义的主要是权衡。如果你刚开始,我建议你在开发时从一个项目开始,一旦你开始考虑将你的开发环境移动到一个单独的项目。分期可以任何方式。


I have multiple flavors of my app. How should I set this up server side? My package names are:

com.example.app (production) com.example.app.staging (staging) com.example.app.fake (fake)

Should this be 3 separate projects in the firebase console?

解决方案

Largely it will depend on how you want your project to work. You can set all three up in the same console, or you can set up as two or more different projects. Either option is valid.

Benefits of same project:

  • Share the same billing, quotas, permissions, and services (database, storage, FCM etc).
  • Environment which is the same as production.

Benefits of different projects:

  • No risk of overwriting production data or affecting production users.

If using multiple projects, you can take advantage of the build types support which will allow you to have different google-services.json files for different versions. If using one project, the same google-services.json will work for all the varieties.

Note: as CodyMace says in the comments - remember to re-download the JSON file each time you add an app!

There are things you can do to minimise risks in either case (e.g. have dev/ stage/ prod/ keys in your Database, and have similar structures underneath), but what makes sense for you is largely about tradeoffs.

If you're just starting out, I would suggest starting with one project while you're in development, and once you've launched consider moving your development environment to a separate project. Staging could go either way.

这篇关于Firebase 2.0 - 如何处理Android应用程序的多种风味(环境)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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