Tal*_*bal 6 dart firebase firebase-realtime-database flutter
我正在使用 flutter 构建应用程序并集成 firebase。一开始,我的应用程序工作得很好,但一段时间后,遇到这个问题,Firebase 强行终止了应用程序和服务器之间的连接。
W/PersistentConnection(4812):pc_0 - Firebase 数据库连接被服务器强制终止。不会尝试重新连接。原因:数据库位于不同的区域。请将您的数据库 URL 更改为https://multiapp-f0e1e-default-rtdb.europe-west1.firebasedatabase.app
Mad*_*mar 23
发生这种情况是因为,当您当时创建项目时,未启用实时数据库,这就是文件google-services.json不包含url实时数据库的原因。
我也面临着同样的问题,这就是我所做的。
我们还可以下载更新的google-services.json文件。但我手动添加了网址。
由此:
{
"project_info": {
"project_number": "xxx4071207xxx",
"project_id": "xxxantonixxx",
"storage_bucket": "xxxantonixxx.appspot.com"
},
Run Code Online (Sandbox Code Playgroud)
对此:
{
"project_info": {
"project_number": "xxx4071207xxx",
"firebase_url": " https://multiapp-f0e1e-default-rtdb.europe-west1.firebasedatabase.app",
"project_id": "xxxantonixxx",
"storage_bucket": "xxxantonixxx.appspot.com"
},
Run Code Online (Sandbox Code Playgroud)
If you make changes to the google-services.json file. And recompile the app from start, still the changes DONOT take place immediately.
In my case, even if I deleted the google-services.json file and recompile the app again, it was working similar to before deleting.
So, in that case, we'll have to delete the build and .dart_tool folder in our project folder,
Or run flutter clean in terminal
and then recompile the app again from start.
I came to know about this after I wasted my 2 whole days, working in some other direction. That's why I had to share it, so that it doesn't happen to anybody else.
| 归档时间: |
|
| 查看次数: |
6350 次 |
| 最近记录: |