Firebase issue, multiple errors after upgrade - android

After running the Firebase upgrade command, I tried to run my app in the emulator, and the following error messages appeared:
Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/lib/firebase_core.dart:19:7: Error: A function declaration needs an explicit list of parameters.
Try adding a parameter list to the function declaration.
await Firebase.initializeApp(
^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/lib/firebase_core.dart:19:15: Error: Expected '{' before this.
await Firebase.initializeApp(
^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/lib/firebase_core.dart:19:15: Error: Expected a declaration, but got '.'.
await Firebase.initializeApp(
^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/lib/firebase_core.dart:20:8: Error: Non-optional parameters can't have a default value.
Try removing the default value or making the parameter optional.
options: DefaultFirebaseOptions.currentPlatform,
^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/lib/firebase_core.dart:21:2: Error: Expected a function body or '=>'.
Try adding {}.
);
^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/lib/firebase_core.dart:23:1: Error: Directives must appear before any declarations.
Try moving the directive before any declarations.
part 'src/firebase_app.dart';
^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/lib/firebase_core.dart:24:1: Error: Directives must appear before any declarations.
Try moving the directive before any declarations.
part 'src/firebase.dart';
^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/lib/firebase_core.dart:15:8: Error: Error when reading '/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/lib/firebase_options.dart': O sistema não pode encontrar o arquivo especificado.
import 'firebase_options.dart';
^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/lib/src/firebase.dart:9:7: Error: 'Firebase' is already declared in this scope.
class Firebase {
^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/lib/firebase_core.dart:19:7: Context: Previous declaration of 'Firebase'.
await Firebase.initializeApp(
^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/lib/firebase_core.dart:19:1: Error: Type 'await' not found.
await Firebase.initializeApp(
^^^^^
lib/main.dart:12:9: Error: Can't use 'Firebase' because it is declared more than once.
await Firebase.initializeApp(
^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/lib/firebase_core.dart:20:10: Error: Undefined name 'DefaultFirebaseOptions'.
options: DefaultFirebaseOptions.currentPlatform,
^^^^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/lib/src/firebase.dart:66:19: Error: Can't use 'Firebase' because it is declared more than once.
if (other is! Firebase) return false;
^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/lib/src/firebase.dart:75:26: Error: Can't use 'Firebase' because it is declared more than once.
String toString() => '$Firebase';
^
FAILURE: Build failed with an exception.
Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 49s
Exception: Gradle task assembleDebug failed with exit code 1

I reinstalled flutter and rebuilt the code from scratch and instead of updating Firebase by running the command I just manually set the version number of the dependencies below to the latest one and ran the command flutter pub get, the in order to get updates made to pubsec.yaml. The changed dependencies looked like this:
cupertino_list_tile: ^0.2.1
firebase_core: ^1.24.0
cloud_firestore: ^3.5.1
firebase_auth: ^3.11.2
cloud_functions: ^3.3.9
That done, I ran my code again and everything worked as expected.

Related

Flutter build issue apk build fail

I am getting the following issue while building the apk :
/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.3.3/lib/src/structs.g.dart:661:31: Error: Member not found: 'UnicodeChar'.
int get UnicodeChar => Char.UnicodeChar;
^^^^^^^^^^^
/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.3.3/lib/src/structs.g.dart:662:38: Error: Setter not found: 'UnicodeChar'.
set UnicodeChar(int value) => Char.UnicodeChar = value;
^^^^^^^^^^^
/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.3.3/lib/src/structs.g.dart:664:29: Error: Member not found: 'AsciiChar'.
int get AsciiChar => Char.AsciiChar;
^^^^^^^^^
/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.3.3/lib/src/structs.g.dart:665:36: Error: Setter not found: 'AsciiChar'.
set AsciiChar(int value) => Char.AsciiChar = value;
^^^^^^^^^
/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_calendar_carousel-1.5.3/lib/flutter_calendar_carousel.dart:424:16: Error: The method 'FlatButton' isn't defined for the c
lass '_CalendarState'.
'_CalendarState' is from 'package:flutter_calendar_carousel/flutter_calendar_carousel.dart' ('/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_calendar_carousel-1.5.3/
lib/flutter_calendar_carousel.dart').
Try correcting the name to the name of an existing method, or defining a method named 'FlatButton'.
child: FlatButton(
^^^^^^^^^^
/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_calendar_carousel-1.5.3/lib/src/calendar_header.dart:46:32: Error: The method 'FlatButton' isn't defined for the class 'C
alendarHeader'.
'CalendarHeader' is from 'package:flutter_calendar_carousel/src/calendar_header.dart' ('/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_calendar_carousel-1.5.3/lib/sr
c/calendar_header.dart').
Try correcting the name to the name of an existing method, or defining a method named 'FlatButton'.
Widget _headerTouchable() => FlatButton(
^^^^^^^^^^
*********************************************************
WARNING: This version of flutter_webview_plugin will break your Android build if it or its dependencies aren't compatible with AndroidX.
See https://docs.flutter.dev/development/platform-integration/android/androidx-migration for more information on the problem and how to fix it.
This warning prints for all Android build failures. The real root cause of the error may be unrelated.
*********************************************************
FAILURE: Build failed with an exception.
Where:
Script 'C:\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159
What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
Process 'command 'C:\flutter\flutter\bin\flutter.bat'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 1m 20s
Running Gradle task 'assembleRelease'... 81.7s
Gradle task assembleRelease failed with exit code 1
Link to the project source code - https://drive.google.com/drive/folders/1GaNcymRQ1SmQDln-0JpsoEG_9Gy3sOn7?usp=sharing
Please help as soon as possible.
Thank You
By looking at this section of error, your dependencies might not be compatible with AndroidX.
WARNING: This version of flutter_webview_plugin will break your Android build if it or its dependencies aren't compatible with AndroidX.
According to this github issue you need to migrate to AndroidX. To migrate follow these steps -
1 - Open android directory with Android Studio 3.2+.
2 - Click on Refactor then migrate to AndroidX.
After that add these to the gradle.properties file in the android directory.
android.useAndroidX=true
android.enableJetifier=true

Error: Type 'TableMetadata' not found | FAILURE: Build failed with an exception

I am new to flutter and I am facing this issue that after cleaning the build (flutter clean) my code stopped working and it is stuck in build failed..
I tried deleting the flutter SDK and doing that process again but still I am getting the same error messages.
I was trying to fix the Firebase login and replaced the 'google-services.json' file and then after these commands flutter [clean build, pub get and pub upgrade] the code is stuck in build.
(this is the error message and the screenshot)
Running Gradle task 'assembleDebug'...
../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.5.1+5/lib/src/widget_factory.dart:60:57: Error: Type 'TableMetadata' not found.
Widget buildTable(BuildMetadata m, TextStyleHtml tsh, TableMetadata data) =>
^^^^^^^^^^^^^
../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.5.1+5/lib/src/internal/layout_grid.dart:7:24: Error: Type 'TableMetadata' not found.
TextStyleHtml tsh, TableMetadata data) {
^^^^^^^^^^^^^
../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.5.1+5/lib/src/widget_factory.dart:60:57: Error: 'TableMetadata' isn't a type.
Widget buildTable(BuildMetadata m, TextStyleHtml tsh, TableMetadata data) =>
^^^^^^^^^^^^^
../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.5.1+5/lib/src/internal/layout_grid.dart:7:24: Error: 'TableMetadata' isn't a type.
TextStyleHtml tsh, TableMetadata data) {
^^^^^^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'D:\Flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 904
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'D:\Flutter\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 6m 10s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 376.2s (!)
Exception: Gradle task assembleDebug failed with exit code 1
I tried to search for this build failed issue but I can't get to fix it.
In your app's pubspec.yaml file look for this line: flutter_widget_from_html and use the version ^ 0.5.1 + 3
Ex: flutter_widget_from_html: ^0.5.1+3
Then click on pub upgrade and run your app
"The easiest fix is to run flutter pub upgrade to make sure both flutter_widget_from_html and flutter_widget_from_html_core is updated together."
Before upgrading pub, you should constrain the newest package version in the pubspec.yaml as flutter_widget_from_html: ^0.5.2
For credit and more info see here

Android Studio Flutter Failure with Gradle - Error

What can I do to solve this error?
I am coding the login page for my app, I am using SVG. Unfortunately I saw this error.
I used these codes but I did not get any results: flutter pub cache repair
flutter clean
Running Gradle task 'assembleDebug'...
../../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:26: Error: Type 'DiagnosticableMixin' not found.
class PictureStream with DiagnosticableMixin {
^^^^^^^^^^^^^^^^^^^
../../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:44: Error: Type 'DiagnosticableMixin' not found.
abstract class PictureStreamCompleter with DiagnosticableMixin {
^^^^^^^^^^^^^^^^^^^
../../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:7: Error: The type 'DiagnosticableMixin' can't be mixed in.
class PictureStream with DiagnosticableMixin {
^
../../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:16: Error: The type 'DiagnosticableMixin' can't be mixed in.
abstract class PictureStreamCompleter with DiagnosticableMixin {
^
../../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:167:11: Error: Superclass has no method named 'debugFillProperties'.
super.debugFillProperties(properties);
^^^^^^^^^^^^^^^^^^^
../../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:171:30: Error: The method 'toStringShort' isn't defined for the class 'PictureStreamCompleter'.
- 'PictureStreamCompleter' is from 'package:flutter_svg/src/picture_stream.dart' ('../../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart').
Try correcting the name to the name of an existing method, or defining a method named 'toStringShort'.
ifPresent: _completer?.toStringShort(),
^^^^^^^^^^^^^
../../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:266:11: Error: Superclass has no method named 'debugFillProperties'.
super.debugFillProperties(description);
^^^^^^^^^^^^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'C:\android\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 904
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\android\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 9s
Exception: Gradle task assembleDebug failed with exit code 1
Thanks!
I fixed this error using dependency override. Add the following to your pubspec.yaml
dependency_overrides:
flutter_svg: 0.18.0

Keep getting errors after flutter clean and upgrading to latest version

So I decided to upgrade the flutter to the latest stable version 2, I used flutter clean then after the flutter upgrade, I kept getting this error intl version dependency
PS D:\Flutter\flutter-app> flutter run
Because fstore depends on flutter_localizations any from sdk which depends on intl 0.17.0, intl 0.17.0 is required.
So, because fstore depends on intl ^0.16.1, version solving failed.
Running "flutter pub get" in flutter-app...
pub get failed (1; So, because fstore depends on intl ^0.16.1, version solving failed.)
so after changing the dependency to
dependency_overrides:
intl: 0.17.0
I started getting these errors, before the clean build and upgrade everything was working fine
PS D:\Flutter\codecanyon-8n5MtXRZ-fluxstore-woocommerce-flutter-ecommerce-full-app> flutter run
Launching lib\main.dart on SM N950F in debug mode...
lib/widgets/firebase/firebase_cloud_messaging_wapper.dart:32:24: Error: The method 'configure' isn't defined for the class 'FirebaseMessaging'.
- 'FirebaseMessaging' is from 'package:firebase_messaging/firebase_messaging.dart' ('../Flutter_SDK/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-8.0.0-dev.15/lib/firebase_messaging.dart').
Try correcting the name to the name of an existing method, or defining a method named 'configure'.
_firebaseMessaging.configure(
^^^^^^^^^
lib/widgets/firebase/firebase_cloud_messaging_wapper.dart:42:24: Error: The getter 'onIosSettingsRegistered' isn't defined for the class 'FirebaseMessaging'.
- 'FirebaseMessaging' is from 'package:firebase_messaging/firebase_messaging.dart' ('../Flutter_SDK/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-8.0.0-dev.15/lib/firebase_messaging.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'onIosSettingsRegistered'.
_firebaseMessaging.onIosSettingsRegistered
^^^^^^^^^^^^^^^^^^^^^^^
lib/models/user_model.dart:64:14: Error: Not a constant expression.
case AuthorizationStatus.authorized:
^^^^^^^^^^^^^^^^^^^
lib/models/user_model.dart:64:14: Error: 'AuthorizationStatus' is imported from both 'package:apple_sign_in/apple_sign_in.dart' and 'package:firebase_messaging_platform_interface/src/types.dart'.
case AuthorizationStatus.authorized:
^^^^^^^^^^^^^^^^^^^
lib/models/user_model.dart:86:14: Error: Not a constant expression.
case AuthorizationStatus.error:
^^^^^^^^^^^^^^^^^^^
lib/models/user_model.dart:86:14: Error: 'AuthorizationStatus' is imported from both 'package:apple_sign_in/apple_sign_in.dart' and 'package:firebase_messaging_platform_interface/src/types.dart'.
case AuthorizationStatus.error:
^^^^^^^^^^^^^^^^^^^
lib/models/user_model.dart:89:14: Error: Not a constant expression.
case AuthorizationStatus.cancelled:
^^^^^^^^^^^^^^^^^^^
lib/models/user_model.dart:89:14: Error: 'AuthorizationStatus' is imported from both 'package:apple_sign_in/apple_sign_in.dart' and 'package:firebase_messaging_platform_interface/src/types.dart'.
case AuthorizationStatus.cancelled:
^^^^^^^^^^^^^^^^^^^
lib/screens/home/onboard_screen.dart:207:19: Error: No named parameter with the name 'enableSlideIcon'.
enableSlideIcon: true,
^^^^^^^^^^^^^^^
../Flutter_SDK/.pub-cache/hosted/pub.dartlang.org/liquid_swipe-2.0.1/lib/liquid_swipe.dart:211:9: Context: Found this candidate, but the arguments don't match.
const LiquidSwipe({
^^^^^^^^^^^
../Flutter_SDK/.pub-cache/hosted/pub.dartlang.org/extended_image-2.0.0/lib/src/extended_image.dart:786:44: Error: No named parameter with the name 'nullOk'.
_invertColors = MediaQuery.of(context, nullOk: true)?.invertColors ??
^^^^^^
../Flutter_SDK/packages/flutter/lib/src/widgets/media_query.dart:818:25: Context: Found this candidate, but the arguments don't match.
static MediaQueryData of(BuildContext context) {
^^
../Flutter_SDK/.pub-cache/hosted/pub.dartlang.org/wave-0.1.0/lib/config.dart:46:13: Error: Method not found: 'throwNullError'.
throwNullError('custom', 'colors` or `gradients');
^^^^^^^^^^^^^^
../Flutter_SDK/.pub-cache/hosted/pub.dartlang.org/wave-0.1.0/lib/config.dart:60:13: Error: Method not found: 'throwNullError'.
throwNullError('custom', 'durations');
^^^^^^^^^^^^^^
../Flutter_SDK/.pub-cache/hosted/pub.dartlang.org/wave-0.1.0/lib/config.dart:66:13: Error: Method not found: 'throwNullError'.
throwNullError('custom', 'heightPercentages');
^^^^^^^^^^^^^^
../Flutter_SDK/.pub-cache/hosted/pub.dartlang.org/stripe_sdk-4.0.2/lib/src/models/card.dart:55:38: Error: Too few positional arguments: 2 required, 1 given.
return _ccValidator.validateCVV(cvc, cardType: cardType).isValid;
^
../Flutter_SDK/.pub-cache/hosted/pub.dartlang.org/stripe_sdk-4.0.2/lib/src/models/card.dart:57:38: Error: Too few positional arguments: 2 required, 1 given.
return _ccValidator.validateCVV(cvc).isValid;
^
FAILURE: Build failed with an exception.
* Where:
Script 'D:\Flutter\Flutter_SDK\packages\flutter_tools\gradle\flutter.gradle' line: 991
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'D:\Flutter\Flutter_SDK\bin\flutter.bat'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full
insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 5m 36s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 342.1s
Exception: Gradle task assembleDebug failed with exit code 1
Any help will be really appreciated.
Run 'flutter pub upgrade' . It'll update your dependencies to play along nicely with each other.

Flutter error on building files in Android Studio

I have newly installed Flutter on Android Studio. I had a source code of flutter which I want to open using it. I installed the latest flutter plugin and flutter SDK. But when I try to run the app, it shows me the following error:
Compiler message:
/C:/Flutter%20SDK/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.14.4/lib/src/picture_stream.dart:92:3: Error: The superclass, 'Diagnosticable', has no unnamed constructor that takes no arguments.
PictureStream();
^^^^^^^^^^^^^
/C:/Flutter%20SDK/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.14.4/lib/src/picture_stream.dart:192:16: Error: The superclass, 'Diagnosticable', has no unnamed constructor that takes no arguments.
abstract class PictureStreamCompleter extends Diagnosticable {
^
Compiler message:
/C:/Flutter%20SDK/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.14.4/lib/src/picture_stream.dart:92:3: Error: The superclass, 'Diagnosticable', has no unnamed constructor that takes no arguments.
PictureStream();
^^^^^^^^^^^^^
/C:/Flutter%20SDK/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.14.4/lib/src/picture_stream.dart:192:16: Error: The superclass, 'Diagnosticable', has no unnamed constructor that takes no arguments.
abstract class PictureStreamCompleter extends Diagnosticable {
^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Flutter SDK\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 882
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Flutter SDK\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 23s
Exception: Gradle task assembleDebug failed with exit code 1
I am completely new to this and have no idea where this error is pointing. I have the latest Flutter SDK version: Flutter 1.17.0 and Dart 2.8.1, it's a stable version. My Android Studio version is 3.6.2
Try executing this in your terminal :
flutter pub cache repair
If it doesn't work, deleting the flutter folder, along with the cache folder should do the job.
In my case i solved this problem adding the latest version of flutter svg to pubspec.yaml
Check the link to install latest version: https://pub.dev/packages/flutter_svg#-installing-tab-

Categories

Resources