Closed rubenvisser22 closed 1 year ago
Thanks for the report @rubenvisser22 Is the error occurring when you run it on emulator specifically ? or with physical device too ? Can you try the plugin example and see if using it, you get same behavior or not ?
Thanks for the report @rubenvisser22 Is the error occurring when you run it on emulator specifically ? or with physical device too ? Can you try the plugin example and see if using it, you get same behavior or not ?
Hi thanks for the reply! Yes it is when I run the code on the emulators(pixel 4 and 6 ). I can't test it on a physical device, because I don't have an andriod.
I am unable to replicate this on Android using plugin example or code sample provided above, although per log, it seems to be warning (W/DynamiteModule)
,but there have been similar reports as below, so keeping this issue open and labeling for team's attention and insights:
https://github.com/firebase/flutterfire/issues/9967 https://github.com/firebase/flutterfire/issues/7660 https://github.com/firebase/flutterfire/issues/7257 https://github.com/firebase/flutterfire/issues/5810
Reading your flutter doctor
it seems that you're using an old version of the emulator:
• AOSP on IA Emulator (mobile) • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
Can you try to update your emulator with an image that has the Google Services properly included?
You can also try this on a real device? As @darshankawar mentioned this is a warning and shouldn't prevent you from writing to Firebase, you must have something else wrong in your configuration. You can check the example apps included in this repository to get a working example.
Reading your
flutter doctor
it seems that you're using an old version of the emulator:• AOSP on IA Emulator (mobile) • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
Can you try to update your emulator with an image that has the Google Services properly included?
You can also try this on a real device? As @darshankawar mentioned this is a warning and shouldn't prevent you from writing to Firebase, you must have something else wrong in your configuration. You can check the example apps included in this repository to get a working example.
Hi I tried changing the image twice both return this in flutter doctor -v
:
sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 13 (API 33) (emulator)
Changing the image twice and updating google service did not work...
@rubenvisser22 Do you have the warning and cannot use Firebase or do you have the warning and can use Firebase? Did you try on a real device? (Your computer / emulator might be misconfigured)
@Lyokone I have the warning and can use Firebase, because one time flutter did create a collection in firebase. but that was the only time. I don't know why it did it then, since there was the same warning then.
I can't try it on a real device, because I don't have an andriod device (except my computer).
I also tried the following: turn the emulator on and off. tried different emulator updated google play services turnt bluetooth off turnt internet off and on enabled sign in with mail and password adding in andriodManifest.xml
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
@rubenvisser22 Can you go on the Internet using Chrome on your Android Emulator?
@Lyokone Yes I can
I'm out of ideas to help you since I cannot reproduce the issue. I would suggest creating a new empty project to see if you still cannot access Firebase.
@Lyokone Okay, Thanks for the effort!
Hey @rubenvisser22. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Since there haven't been any recent updates here, I am going to close this issue.
@rubenvisser22 if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.
Hello there,
I had this issue using Flutter and was able to fix the problem by doing two things:
firebase.json
file:Instead of this:
{
"emulators": {
"firestore": {
"port": 8080
},
"ui": {
"enabled": true,
"port": 4004
},
"singleProjectMode": true
}
}
Do this: (note the "host"
key in the json):
-- For some reason, note this can also be "host": "0.0.0.0"
but NOT "host": "127.0.0.1"
{
"emulators": {
"firestore": {
"host": "10.0.0.58",
"port": 8080
},
"ui": {
"enabled": true,
"host": "localhost",
"port": 4004
},
"singleProjectMode": true
}
}
Instead of this:
import 'package:cloud_firestore/cloud_firestore.dart';
final FirebaseFirestore fbFirestoreInstance = FirebaseFirestore.instance;
Do this:
import 'dart:io' show Platform;
import 'package:cloud_firestore/cloud_firestore.dart';
final String emulatorHost = Platform.isAndroid ? '10.0.0.58' : 'localhost';
final FirebaseFirestore fbFsEmulatorInstance = FirebaseFirestore.instance;
fbFsEmulatorInstance.settings = Settings(
host: '$emulatorHost:8080',
sslEnabled: false,
persistenceEnabled: false,
);
**Note this works for me in the Android Emulator, but not with a real Android device. I guess this is because the Android Emulator is running in my laptop and so, the network connection is coming from the same MAC Address? - Not sure about this. In any case, both real and virtual android devices work fine with the real Firebase back-end service.
Bug report
Describe the bug Flutter is not writing data to my firebase collection
Steps to reproduce
https://www.youtube.com/watch?v=EA7973HI93E&list=PL4cUxeGkcC9j--TKIdkb3ISfRbJeJYQwC&index=18
Steps to reproduce the behavior:
Run the app, register a user.
Expected behavior
I expected that the user will be made and data to the collection added
the output
my database.dart code:
Flutter doctor
Flutter (Channel stable, 3.3.8, on Microsoft Windows [Version 10.0.19044.2251], locale en-GB) • Flutter version 3.3.8 on channel stable at C:\src\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 52b3dc25f6 (3 weeks ago), 2022-11-09 12:09:26 +0800 • Engine revision 857bd6b74c • Dart version 2.18.4 • DevTools version 2.15.0
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0) • Android SDK at C:\Users\ruben\AppData\Local\Android\sdk • Platform android-33, build-tools 33.0.0 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) • All Android licenses accepted.
[√] Chrome - develop for the web • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.3.4) • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community • Visual Studio Community 2022 version 17.3.32901.215 • Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2021.3) • Android Studio at C:\Program Files\Android\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.13+0-b1751.21-8125866)
[√] IntelliJ IDEA Community Edition (version 2019.3) • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.3.4 • 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
[√] VS Code (version 1.73.1) • VS Code at C:\Users\ruben\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.54.0
[√] Connected device (4 available) • AOSP on IA Emulator (mobile) • emulator-5554 • android-x86 • Android 9 (API 28) (emulator) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.2251] • Chrome (web) • chrome • web-javascript • Google Chrome 108.0.5359.71 • Edge (web) • edge • web-javascript • Microsoft Edge 107.0.1418.62
[√] HTTP Host Availability • All required HTTP hosts are available
• No issues found!
Flutter dependencies
Dart SDK 2.18.4 Flutter SDK 3.3.8 my_app 1.0.0+1
dependencies:
dev dependencies:
transitive dependencies: