【问题标题】:How do I fix "Could not reach Cloud Firestore Backend" error?如何修复“无法访问 Cloud Firestore 后端”错误?
【发布时间】:2021-09-10 07:46:58
【问题描述】:

我正在构建一个简单的应用程序,但我不断收到此错误:

“W/Firestore: (23.0.1) [OnlineStateTracker]: 无法到达云端 Firestore 后端。后端在 10 秒内没有响应。 这通常表明您的设备目前没有健康的互联网连接。客户将在 离线模式,直到它能够成功连接到后端。”

我不知道为什么,因为我的 Wifi 已满负荷。任何人都可以帮助解决这个问题吗?我正在使用 Java、Android Studio,并且正在使用虚拟设备测试我的应用。

我在底部添加我的代码。所有这些代码都在我的 OnCreate 方法中。

DocumentReference mDocRef = FirebaseFirestore.getInstance().document(document_path);
    mDocRef.get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
        @Override
        public void onSuccess(DocumentSnapshot documentSnapshot){
            if(documentSnapshot.exists()){
                int Rent_amount = (int) documentSnapshot.get(Rent);
                int Food_amount = (int) documentSnapshot.get(Food);
                int Bills_amount = (int) documentSnapshot.get(Bills);

                TextView Rent_test = (TextView) findViewById(R.id.rent_view);
                Rent_test.setText(String.valueOf(Rent_amount));

                TextView Food_test = (TextView) findViewById(R.id.Food_view);
                Food_test.setText(String.valueOf(Food_amount));

                TextView Bills_test = (TextView) findViewById(R.id.Bills_view);
                Bills_test.setText(String.valueOf(Bills_amount));
            }
        }
    });

非常感谢您的帮助!

【问题讨论】:

    标签: java android firebase android-studio google-cloud-firestore


    【解决方案1】:

    我解决了这个问题。我将虚拟设备的类型更改为没有 Google Play 符号的类型。

    【讨论】:

      猜你喜欢
      • 2020-09-29
      • 2020-01-06
      • 2019-02-07
      • 2018-09-15
      • 1970-01-01
      • 2021-08-23
      • 2021-09-05
      • 2021-08-13
      • 2022-06-15
      相关资源
      最近更新 更多