Flutter build issue apk build fail - android

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

Related

Flutter Build Issue

When I try to open the application made with Flutter on the test device, I get the following error. I tried many methods but could not get a successful result. What do you think is the error and how can I resolve it?
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/provider-2.0.1+1/lib/src/provider.dart:179:19: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/src/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'inheritFromWidgetOfExactType'.
? context.inheritFromWidgetOfExactType(type) as _Provider<T>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/provider-2.0.1+1/lib/src/provider.dart:180:19: Error: The method 'ancestorInheritedElementForWidgetOfExactType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/src/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ancestorInheritedElementForWidgetOfExactType'.
: context.ancestorInheritedElementForWidgetOfExactType(type)?.widget
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991
* 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
BU�LD FAILED in 2m 0s
Exception: Gradle task assembleDebug failed with exit code 1
It looks like you're using the version 2.0.1 of the Provider Library.
This version isn't compatible with the newest versions of Flutter, since the inheritFromWidgetOfExactType was deprecated in Flutter 1.12
You have two choices here, either downgrade the version of Flutter you're using to be below 1.12, or upgrade your Provider import to a newer one (I strongly recommend you to pick the second option !)
You should try this.
Yesterday I Just restarted my pc and got this issue. I tried to search for the solution to this problem but nothing works in my case.
Solution
Just delete your flutter folder (Flutter Source) and then reinstall it. Your problem will solve.

Flutter - Error: The language version override has to be the same in the library and its part(s)

I was update my Flutter SDK version from dev channel (1.14.5) to stable channel (2.0.1). My codes was works perfectly but now i get this error. I think the problem is at slide_countdown_clock but im not sure.
lib/Screens/sets4_widget/Countdown.dart:7:6: Error: The language version override has to be the same in the library and its part(s).
part 'package:slide_countdown_clock/clip_digit.dart';
^
lib/Screens/sets4_widget/Countdown.dart:8:6: Error: The language version override has to be the same in the library and its part(s).
part 'package:slide_countdown_clock/digit.dart';
^
lib/Screens/sets4_widget/Countdown.dart:9:6: Error: The language version override has to be the same in the library and its part(s).
part 'package:slide_countdown_clock/slide_direction.dart';
^
FAILURE: Build failed with an exception.
* Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\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 13s
Exception: Gradle task assembleDebug failed with exit code 1
^
I also share the lines of code that the error pointed to me below.
part 'package:slide_countdown_clock/clip_digit.dart';
part 'package:slide_countdown_clock/digit.dart';
part 'package:slide_countdown_clock/slide_direction.dart';
those parts are give me error. I tried flutter clean > flutter upgrade > flutter pub upgrade but still no result. Can anyone please help?
slide_countdown_clock, this package does not support Null Safety and Flutter 2.0.1 is a version with null safety.
So, you can't use it on Flutter version 2.0.1. Try to use another pub package that supports Null Safety.
You should not upgrade to Flutter version 2.0.1 until your existing project's dependencies are not supporting Null Safety.
I know this doesn't apply to your case, but I had this error as well and in my case it was due to the fact that I had the library code in the lib folder of the project using it. Just moving it in a different location solved my issue.

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

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