Home > Software engineering >  Flutter -Firebase/FireStore - Could not reach Cloud Firestore backend. Backend didn't respond w
Flutter -Firebase/FireStore - Could not reach Cloud Firestore backend. Backend didn't respond w

Time:09-03

I am currently working on a Flutter project in VSCode, using firestore as my DB. I have been working on this project for many months and have had no problems with connecting to firestore in any way. Recently I got new hard drives and I transferred all my files, and everything compiles correctly. I have updated all dependencies, Flutter Doctor has no issues, and I have searched for hours on previous posts, trying almost every solution with none working.

I have not changed any of my code in-between it working and not working. I have changed many settings and config files trying to get it to work now.

Two Important Notes

  1. I am trying on emulators through Android Studio. I have tried on 3 different emulators.
    • 1 with google play services installed
    • 1 without google play services installed
    • 1 without google play services installed, that I manually added

All of them have the same issue.

  1. I have the old build running on many devices currently accessing the database successfully.

Error I am getting

W/DynamiteModule( 6511): Local module descriptor class for com.google.android.gms.providerinstaller.dynamite not found.
I/DynamiteModule( 6511): Considering local module com.google.android.gms.providerinstaller.dynamite:0 and remote module com.google.android.gms.providerinstaller.dynamite:0
W/ProviderInstaller( 6511): Failed to load providerinstaller module: No acceptable module com.google.android.gms.providerinstaller.dynamite found. Local version is 0 and remote version is 0.
W/ProviderInstaller( 6511): Failed to report request stats: com.google.android.gms.common.security.ProviderInstallerImpl.reportRequestStats [class android.content.Context, long, long]
W/Firestore( 6511): (24.2.2) [OnlineStateTracker]: Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds
W/Firestore( 6511):
W/Firestore( 6511): This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.
W/DynamiteModule( 6511): Local module descriptor class for com.google.android.gms.providerinstaller.dynamite not found.
W/Firestore( 6511): (24.2.2) [WatchStream]: (4aed552) Stream closed with status: Status{code=UNAVAILABLE, description=Channel shutdownNow invoked, cause=null}.
I/DynamiteModule( 6511): Considering local module com.google.android.gms.providerinstaller.dynamite:0 and remote module com.google.android.gms.providerinstaller.dynamite:0
W/ProviderInstaller( 6511): Failed to load providerinstaller module: No acceptable module com.google.android.gms.providerinstaller.dynamite found. Local version is 0 and remote version is 0.
W/ProviderInstaller( 6511): Failed to report request stats: com.google.android.gms.common.security.ProviderInstallerImpl.reportRequestStats [class android.content.Context, long, long]

Steps I've tried from other forum posts:

  1. put in all 3 AndroidManifest.xml files
  2. put in AndroidManifest.xml under main
  3. Enabled Multidex
  4. Used a different wifi connection
  5. Checked back the second day with the same issue
  6. My minimum SDK version is 21
  7. The emulators all have wifi connections. (I have tested by searching online)
  8. Others that I don't remember

Flutter Doctor:

[√] Flutter (Channel stable, 3.3.0, on Microsoft Windows [Version 10.0.19044.1889], locale en-US)
    • Flutter version 3.3.0 on channel stable at D:\Coding\Flutter\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ffccd96b62 (2 days ago), 2022-08-29 17:28:57 -0700
    • Engine revision 5e9e0e0aa8
    • Dart version 2.18.0
    • DevTools version 2.15.0

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at C:\Users\mjdk9\AppData\Local\Android\sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: D:\Applications\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.12 7-b1504.28-7817840)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.3.3)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.3.32825.248
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2021.2)
    • Android Studio at D:\Applications\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12 7-b1504.28-7817840)

[√] Connected device (4 available)
    • sdk gphone x86 (mobile) • emulator-5554 • android-x86    • Android 11 (API 30) (emulator)
    • Windows (desktop)       • windows       • windows-x64    • Microsoft Windows [Version 10.0.19044.1889]
    • Chrome (web)            • chrome        • web-javascript • Google Chrome 104.0.5112.102
    • Edge (web)              • edge          • web-javascript • Microsoft Edge 104.0.1293.70

[√] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

pubspec.yaml dependencies

dependencies:
  flutter:
    sdk: flutter


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  firebase_core: ^1.4.0
  firebase_auth: ^3.0.1
  cloud_firestore: ^3.4.6
  firebase_analytics: ^9.3.3
  material_floating_search_bar: ^0.3.4
  provider: ^6.0.3
  flutter_launcher_icons: ^0.10.0
  url_launcher: ^6.0.10
  url_launcher_web: ^2.0.4
  flutter_rating_bar: ^4.0.0
  smooth_star_rating: ^1.1.1
  dropdown_button2: ^1.0.7
  confetti: ^0.7.0
  flutter_native_splash: ^2.1.6
  http: ^0.13.4
  get: ^4.6.1
  audioplayers: ^1.0.1
  loader_overlay: ^2.0.6
  webview_flutter: ^3.0.2
  syncfusion_flutter_datagrid: ^20.1.61
  cloud_functions: ^3.2.17

app/build.gradle

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'

defaultConfig {
        multiDexEnabled true
        applicationId "com.mjdk99.matter_medical_supplies"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation platform('com.google.firebase:firebase-bom:30.3.2')
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.android.gms:play-services-location:18.0.0'
}

build.gradle

buildscript {
    ext.kotlin_version = '1.6.10'
    repositories {
        google()
        mavenCentral()
        jcenter()
    }

    dependencies {
        classpath 'com.google.gms:google-services:4.3.13'
        classpath 'com.android.tools.build:gradle:4.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        jcenter()
    }
}

CodePudding user response:

Right now I am also having this issue with android emulators not connecting to my firebase, with no issues on my physical devices. However, I am able to use the same project but with Firebase emulator suite instead of my db.

Might not solve your problem, but at least it's a workaround until you resolve the issue.

CodePudding user response:

I solved my problem. I tried two different wifi's at work, with still having the same error. When I logged into my wifi at home it finally worked. I should've tried this days ago. it would have saved many hours of frustration.

I am not sure what the different is, since I had done everything at work before I got new HDs. Something just to be aware of.

  • Related