I am developing a project with flutter and i want to add crashlytics to my project. Everything else works but flutterfire configure
is giving me json error. I look every where for all possible answers but still not solving the issue.
npm commands
- firebase login
- npm install -g firebase-tools
- dart pub global activate flutterfire_cli
- flutterfire configure
all these commands is also works in android studio terminal. but flutterfire gives json error.
I already added the android dependencies for firebase.
error log
⠏ 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)
<asynchronous suspension>
#6 getProjects (package:flutterfire_cli/src/firebase.dart:114:20)
<asynchronous suspension>
#7 ConfigCommand._selectFirebaseProject (package:flutterfire_cli/src/commands/config.dart:278:24)
<asynchronous suspension>
#8 ConfigCommand.run (package:flutterfire_cli/src/commands/config.dart:368:37)
<asynchronous suspension>
#9 CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#10 main (file:///C:/Users/USER/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutterfire_cli-0.2.4/bin/flutterfire.dart:57:5)
<asynchronous suspension>
⠧ 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)
<asynchronous suspension>
#6 getProjects (package:flutterfire_cli/src/firebase.dart:114:20)
<asynchronous suspension>
#7 ConfigCommand._selectFirebaseProject (package:flutterfire_cli/src/commands/config.dart:278:24)
<asynchronous suspension>
#8 ConfigCommand.run (package:flutterfire_cli/src/commands/config.dart:368:37)
<asynchronous suspension>
#9 CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#10 main (file:///C:/Users/USER/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutterfire_cli-0.2.4/bin/flutterfire.dart:57:5)
<asynchronous suspension>
Would you please help me to solve this issue?
8
Answers
Try installing the Firebase CLI using the standalone binary instead of NPM on Windows, or the install script on Mac.
**** update ****
i resolve error by this step :
1 – re connect to network
2 – run
dart pub global activate flutterfire_cli
3- run
flutterfire configure
see Docs help you to get started
Add Firebase To Flutter App
hope this help you
same error here i used firebase in another project but in this project it give me this
and this content file
following steps helped me:
update firebase cli
curl -sL firebase.tools | upgrade=true bash
call
firebase login –reauth
reference:
https://github.com/invertase/flutterfire_cli/issues/27
For those of us on windows, do not forget to check if you are running an old version which you may have configured the PATH to point to. This seemed to be the problem in my case. I resolved by removing the old windows binary, then did a fresh install using npm (a fresh/updated windows install may work too). :
followed by:
then:
downloading and installing the node.js setup does the trick for me,
after installation, search for the node.js terminal , then run ‘firebase login’, after login successfully, then run ‘dart pub global activate flutterfire_cli’, after succesfully getting the flutterfire cli, then navigate to the folder where the flutter app you created is using the cd(change directory)
after navigating to the directory, then run ‘flutterfire configure’
this would create a firebase project in your flutter app project. finish
install latest version of npm and then run command of flutter fire.
example: from any directory run: npm install -g npm@latest version
=> npm install -g [email protected]
as of now latest version of npm is 9.2.0
for linux and mac update the npm package