Reputation: 511
I am using Firebase Firestore in my flutter application. Everything works fine in debug
mode. But, in release
mode I get the following error.
I saw a similar question, but it doesn't solve my issue.
[ERROR:flutter/lib/ui/ui_dart_state.cc(199)] 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 ( 3646): #0 MethodChannelDocumentReference.get
(package:cloud_firestore_platform_interface/src/method_channel/method_channel_document_reference.dart:80)
E/flutter ( 3646): <asynchronous suspension>
E/flutter ( 3646): #1 DocumentReference.get (package:cloud_firestore/src/document_reference.dart:58)
E/flutter ( 3646): <asynchronous suspension>
$ flutter doctor
>> Flutter (Channel stable, 2.2.3, Version 10.0.21996.1)
>> • No issues found!
I tried
INTERNET
permission.Current Versions
firebase_core: 1.6.0
firebase_auth: 2.0.0
cloud_firestore: 1.0.7
Any help/suggestions would be so grateful.
Upvotes: 8
Views: 9292
Reputation: 1285
For me it was database ID, make sure you DB ID is set correctly if you have any specific one, else use default one
Upvotes: 0
Reputation: 2393
If you are switching between firebase emulator and live firebase then uninstall the app and restarting the device fixes this issue.
Upvotes: 0
Reputation: 861
For me, this was solved by creating a database in firestore. Try creating a database in firestore using this link.
Upvotes: 0
Reputation: 194
In My case, I had to enable Cloud Firestore API (via a sample URL below) to get the job done. Make sure the database exists for the cited project in the firebase. Sometimes times internet affected it as well.
Stream closed with status: Status{code=PERMISSION_DENIED, description=Cloud Firestore API has not been used in project whatsapp-439af before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/firestore.googleapis.com/overview?project=abcdef-1234f then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry
Upvotes: 0
Reputation: 6216
For anyone else looking, there is a recent issue with a package dependency incompatibility for cloud_firestore and mlkit you may experience.
See the official issue here:
https://github.com/firebase/firebase-android-sdk/issues/5197
You will know if this is your issue by looking at the logs, if you find the following error message that is likely it:
W/Firestore( 7928): (24.7.0) [OnlineStateTracker]: Could not reach Cloud Firestore backend. Connection failed 1 times. Most recent error: Status{code=INTERNAL, description=error in frame handler, cause=java.lang.NoSuchMethodError: No interface method getBuffer()Lokio/Buffer; in class Lokio/BufferedSource; or its super classes (declaration of 'okio.BufferedSource'
Upvotes: 0
Reputation: 111
In my case I forgot to check exist
final doc = await docRef.doc(docId).get();
// got error here
data = doc.data();
fixed by add check exits
final doc = await docRef.doc(docId).get();
if (doc.exists) {
data = doc.data();
}
Upvotes: 0
Reputation: 2478
I think it is not an issue of library
. It is coding issue
, please check some below ways to fix it:
flutter clean
and flutter run
.production mode
or test mode
?. Try to switch it for testing.users
is exist on firestore
?That's it.
Upvotes: 0
Reputation: 101
Build using
flutter build --no-shrink
or go to Android > app > build.gradle
and
add
buildTypes {
release {
shrinkResources false
minifyEnabled false
signingConfig signingConfigs.release
}
}
Upvotes: 9
Reputation: 1270
Upgrading Firebase core and Firestore to the latest version solved the issue for me.
Upvotes: 2