英文:
In Flutter, is there a way to use a separate Firebase database for app testing, and then switch to using a real database when real users using app?
问题
我的问题是,我已经发布了一个应用程序,但为了将来的升级,我需要使用一个实时数据库来测试该应用。是否有一种方法可以在测试应用时使用一个单独的Firebase数据库?或者,是否有其他解决方案可以在应用已经部署的情况下进行测试?
英文:
My problem is that I have already published an application, but for future upgrades, I need to test the app with a live database. Is there a way to use a separate Firebase database for testing the app? Alternatively, is there another solution to test the application while it is already deployed?
答案1
得分: 2
你可以通过在你的应用程序中实现"flavors"来实现这一点。这将允许你针对Android的每个"flavor"都有单独的google_services.json
文件,以及针对iOS的每个"flavor"都有单独的GoogleServices_info.plist
文件。
按照以下视频来在你的应用程序中实现"flavors":
视频链接
按照以下中文文章来集成不同的Firebase项目,为每个"flavor"配置:
中文文章链接
如果你使用了flutterfire
命令行工具,那么你可能需要为iOS配置单独的firebase_app_id_file.json
文件,具体操作请参考这篇中文文章:
环境设置中文文章链接
你需要添加构建脚本,以便将
google_services.json
文件和GoogleServices_info.plist
文件放置在正确的位置,以便创建构建。这些脚本在这些中文文章中提供了。
英文:
You can achieve this by implementing flavors in your app. This will allow you to have separate google_services.json
for each flavor in case of android and seperate GoogleServices_info.plist
.
Follow this video to implement flavors in your application:
Link to Video
Follow this medium article to integrate different firebase projects for each flavor:
Link To Medium Article
If you have used flutterfire
cli,then you might need to configure separate
firebase_app_id_file.json
for iOS,for that follow this medium article
Link to Medium Article For Environment Setup
> You will need to add build scripts for google_services.json file and
GoogleServices_info.plist file, In order to place them at the right location while creating a build. Those scripts are provided in these medium articles.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论