Reputation: 21
My problem is I Work on flutter app with firebase i make all the steps to can use firebase and i had this exception when i run flutterfire configure command
⠼ Fetching available Firebase projects...
Unhandled exception:
FormatException: Unexpected character (at character 1)
^
#0 _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1383:5)
#1 _ChunkedJsonParser.parseNumber (dart:convert-patch/convert_patch.dart:1250:9)
#2 _ChunkedJsonParser.parse (dart:convert-patch/convert_patch.dart:915:22)
#3 _parseJson (dart:convert-patch/convert_patch.dart:35:10)
#4 JsonDecoder.convert (dart:convert/json.dart:612:36)
#5 runFirebaseCommand (package:flutterfire_cli/src/firebase.dart:95:25)
#6 getProjects (package:flutterfire_cli/src/firebase.dart:114:20)
#7 ConfigCommand._selectFirebaseProject (package:flutterfire_cli/src/commands/config.dart:278:24)
#8 ConfigCommand.run (package:flutterfire_cli/src/commands/config.dart:368:37)
#9 CommandRunner.runCommand (package:args/command_runner.dart:209:13)
#10 main (file:///C:/Users/IT/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutterfire_cli-0.2.6/bin/flutterfire.dart:57:5)
⠦ Fetching available Firebase projects...
Unhandled exception:
FormatException: Unexpected character (at character 1)
^
#0 _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1383:5)
#1 _ChunkedJsonParser.parseNumber (dart:convert-patch/convert_patch.dart:1250:9)
#2 _ChunkedJsonParser.parse (dart:convert-patch/convert_patch.dart:915:22)
#3 _parseJson (dart:convert-patch/convert_patch.dart:35:10)
#4 JsonDecoder.convert (dart:convert/json.dart:612:36)
#5 runFirebaseCommand (package:flutterfire_cli/src/firebase.dart:95:25)
#6 getProjects (package:flutterfire_cli/src/firebase.dart:114:20)
#7 ConfigCommand._selectFirebaseProject (package:flutterfire_cli/src/commands/config.dart:278:24)
#8 ConfigCommand.run (package:flutterfire_cli/src/commands/config.dart:368:37)
#9 CommandRunner.runCommand (package:args/command_runner.dart:209:13)
#10 main (file:///C:/Users/IT/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutterfire_cli-0.2.6/bin/flutterfire.dart:57:5)
Upvotes: 1
Views: 1998
Reputation: 394
I had the same issue but the above did not work for me and after much research and trying various combinations of things I solved it with the following sequence:
Delete all associated apps from your Firebase project using the Firebase console
Delete the following files in your Flutter project folder (if they exist)
my_project/lib/firebase_options.dart
my_project/ios/firebase_app_id_file.json
my_project/macos/firebase_app_id_file.json
my_project/android/app/google-services.json
my_project/ios/Runner/GoogleService-Info.plist
my_project/macos/Runner/GoogleService-Info.plist
Activate and deactivate the flutterfire_cli with
dart pub global deactivate flutterfire_cli
dart pub global activate flutterfire_cli
For good measure also
firebase login --reauth
Then re-run flutterfire configure
It’s not clear to me whether that all the above steps are necessary (I haven't tried all combinations), but this sequence worked while various subsets of the above did not.
PS I'm developing my Flutter & Firebase project on MacOS with Android Studio.
PPS The flutterfire configure
issue should resolve without deleting the GoogleService-Info.plist
files for ios/macos. However I had a stale/bad plist file for my ios build which caused my ios Flutter app to crash. Deleting the .plist file and recreating it by rerunning `flutterfire configure' resolved this additional issue. Hence my recommended is to delete it upfront.
Upvotes: 0
Reputation: 1583
Probably you have to update the firebase CLI.
Open a terminal and put these commands:
curl -sL firebase.tools | upgrade=true bash
firebase login --reauth
Upvotes: 1