I am trying to set-up Firebase Firestore for my Flutter app, I have done everything as stated in the tutorial in documentation.
I am initializing Firebase like so:
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
}
and my simple code for getting data is here:
Future getData() async {
final data = await FirebaseFirestore.instance
.collection("vinland-saga")
.doc("HgeWMoAs5IbIg8HzipTV")
.get();
}
When I am trying to get data from the Firestore, I get this error:
Performing hot reload...
Syncing files to device sdk gphone x86...
Reloaded 1 of 859 libraries in 1,897ms.
W/DynamiteModule(11596): Local module descriptor class for com.google.android.gms.providerinstaller.dynamite not found.
I/DynamiteModule(11596): Considering local module com.google.android.gms.providerinstaller.dynamite:0 and remote module com.google.android.gms.providerinstaller.dynamite:0
W/ProviderInstaller(11596): Failed to load providerinstaller module: No acceptable module com.google.android.gms.providerinstaller.dynamite found. Local version is 0 and remote version is 0.
I/ansk.wbijam_ap(11596): The ClassLoaderContext is a special shared library.
I/ansk.wbijam_ap(11596): The ClassLoaderContext is a special shared library.
I/TetheringManager(11596): registerTetheringEventCallback:com.jansk.wbijam_app
V/NativeCrypto(11596): Registering com/google/android/gms/org/conscrypt/NativeCrypto's 295 native methods...
W/ansk.wbijam_ap(11596): Accessing hidden method Ljava/security/spec/ECParameterSpec;->getCurveName()Ljava/lang/String; (greylist, reflection, allowed)
I/ProviderInstaller(11596): Installed default security provider GmsCore_OpenSSL
W/Firestore(11596): (24.2.2) [OnlineStateTracker]: Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds
W/Firestore(11596):
W/Firestore(11596): 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.
E/flutter (11596): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: [cloud_firestore/unavailable] The service is currently unavailable. This is a most likely a transient condition and may be corrected by retrying with a backoff.
E/flutter (11596): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
E/flutter (11596): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:167:18)
E/flutter (11596): <asynchronous suspension>
E/flutter (11596): #2 MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:367:43)
E/flutter (11596): <asynchronous suspension>
E/flutter (11596): #3 MethodChannelDocumentReference.get (package:cloud_firestore_platform_interface/src/method_channel/method_channel_document_reference.dart:68:42)
E/flutter (11596): <asynchronous suspension>
E/flutter (11596): #4 _JsonDocumentReference.get (package:cloud_firestore/src/document_reference.dart:146:7)
E/flutter (11596): <asynchronous suspension>
E/flutter (11596): #5 _HomeState.getData (package:wbijam_app/main.dart:27:18)
E/flutter (11596): <asynchronous suspension>
E/flutter (11596):
W/Firestore(11596): (24.2.2) [WriteStream]: (578340) Stream closed with status: Status{code=UNAVAILABLE, description=Channel shutdownNow invoked, cause=null}.
W/DynamiteModule(11596): Local module descriptor class for com.google.android.gms.providerinstaller.dynamite not found.
W/Firestore(11596): (24.2.2) [WatchStream]: (2c09279) Stream closed with status: Status{code=UNAVAILABLE, description=Channel shutdownNow invoked, cause=null}.
I/DynamiteModule(11596): Considering local module com.google.android.gms.providerinstaller.dynamite:0 and remote module com.google.android.gms.providerinstaller.dynamite:0
W/ProviderInstaller(11596): Failed to load providerinstaller module: No acceptable module com.google.android.gms.providerinstaller.dynamite found. Local version is 0 and remote version is 0.
I have already granted both permissions for internet access in AndroidManifest.xml files everywhere on the Android side of the app:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET"/>
I have disabled firewall, quadruple-checked if my device supports Google Play Services and everything is correctly set up. I have also raised minSDK and enabled multiDexEnabled in gradle. Why doesn't it still work?