I’ve been trying to integrate firebase into my flutter project, however I continually get this error when running the flutterfire configure script. The script runs when it is just ios, but not android.
I’ve blanked out specific identifiers with ////////
% flutterfire configure
i Found 1 Firebase projects.
✔ Select a Firebase project to configure your Flutter application with · //////////// (////////)
✔ Which platforms should your configuration support (use arrow keys & space to select)? · android, ios
i Firebase android app com./////./// registered.
i Firebase ios app com./////./// registered.
Unhandled exception:
FormatException: Unexpected end of input (at character 1)
^
#0 _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1383:5)
#1 _ChunkedJsonParser.close (dart:convert-patch/convert_patch.dart:501:7)
#2 _parseJson (dart:convert-patch/convert_patch.dart:36:10)
#3 JsonDecoder.convert (dart:convert/json.dart:612:36)
#4 FirebaseAndroidOptions.projectIdFromFileContents (package:flutterfire_cli/src/firebase/firebase_android_options.dart:29:29)
#5 FirebaseAndroidGradlePlugins.applyGoogleServicesPlugin (package:flutterfire_cli/src/firebase/firebase_android_gradle_plugins.dart:101:50)
<asynchronous suspension>
#6 FirebaseAndroidGradlePlugins.apply (package:flutterfire_cli/src/firebase/firebase_android_gradle_plugins.dart:240:5)
<asynchronous suspension>
2
Answers
Solved by rebuilding the flutter application with a different file name. Don't know the exact problem, but this is my personal solution after trying everything else.
I fixed this error by the following steps:
Uninstall and Re-install or Update
flutterfire
via these commandsdart pub global deactivate flutterfire_cli
dart pub global activate flutterfire_cli
Delete the
google_services.json
file in the[project_folder]/android/app directory.
Re-run the flutterfire configure command
flutterfire configure