简体   繁体   English

FLUTTER FIREBASE 更改为新实例不适用于 Android

[英]FLUTTER FIREBASE Change to new instance not working for Android

My client has recently changed their Firebase instance (meaning its under a different project, in a different google sign on).我的客户最近更改了他们的 Firebase 实例(意味着它在不同的项目下,在不同的谷歌登录中)。 Ie they have a new instance that they want to use for production.即他们有一个他们想用于生产的新实例。 I created the new instance and project with a different name to avoid any confusion.我用不同的名称创建了新实例和项目以避免任何混淆。 So for Android i removed the old google-services.json and downloaded the new one from Firebase and copied it into the android/app directory.所以对于 Android 我删除了旧的 google-services.json 并从 Firebase 下载新的并将其复制到 android/app 目录中。 Then I reviewed the project level and app level gradel files.然后我查看了项目级别和应用级别的等级文件。 No problems there.那里没有问题。 I checked inside the new google-services.json file and can clearly see that it is pointing to the new instance of Firebase.我检查了新的 google-services.json 文件,可以清楚地看到它指向 Firebase 的新实例。 Here's a snippet below:下面是一个片段:

"project_info": {
"project_number": "506498949424",
"firebase_url": "https://lbds-aeb3d.firebaseio.com",
"project_id": "lbds-aeb3d",
"storage_bucket": "lbds-aeb3d.appspot.com"

}, },

The old name was LittleBigDeals instead of lbds.旧名称是 LittleBigDeals 而不是 lbds。

Actually this process has worked fine for the IOS side of the project.实际上,此过程对于项目的 IOS 方面运行良好。 The app is now pointing at the new database.该应用程序现在指向新数据库。 However when I install it on ANdroid it still retrieves data from the old database.但是,当我将它安装在 ANdroid 上时,它仍然从旧数据库中检索数据。

Is there a pointer I'm missing or that I need to refresh in the Android set up.是否有我丢失的指针或者我需要在 Android 设置中刷新。

Any help with this would be greatly appreciated.对此的任何帮助将不胜感激。

Many thanks.非常感谢。

I had this same issue yesterday.我昨天也有同样的问题。 I had changed to a different Firebase project in my Flutter app.我已在我的 Flutter 应用程序中更改为不同的 Firebase 项目。 iOS worked fine but Android still was attempting to use the incorrect Firebase project, despite google-services.json clearly pointing to the new project. iOS 工作正常,但 Android 仍在尝试使用不正确的 Firebase 项目,尽管 google-services.Z466DEEC76ECDF5FCA6F9Z3 明确指向新项目。 The issue appeared to be limited to my local machine but was very bizarre and annoying.这个问题似乎仅限于我的本地机器,但非常奇怪和烦人。 Another developer suggested that I try the "flutter clean" command, and once I ran flutter clean and re-started the virtual Android device, it then used the correct Firebase instance.另一位开发人员建议我尝试“flutter clean”命令,一旦我运行 flutter clean 并重新启动虚拟 Android 设备,它就会使用正确的 Firebase 实例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM