I recently had to migrate to a new development machine. I downloaded and installed Android Studio and then Flutter. After pulling down the project I am working on I tried to run it. During compile, I run into the following error:
Running Gradle task 'assembleDebug'...
/C:/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.3.6/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.6/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.6/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.6/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_typeahead-3.2.4/lib/src/cupertino_flutter_typeahead.dart:746:9: Error: No named parameter with the name 'maxLengthEnforced'.
maxLengthEnforced: widget.textFieldConfiguration.maxLengthEnforced,
^^^^^^^^^^^^^^^^^
/C:/Flutter/flutter/packages/flutter/lib/src/cupertino/text_field.dart:212:9: Context: Found this candidate, but the arguments don't match.
const CupertinoTextField({
^^^^^^^^^^^^^^^^^^
/C:/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_typeahead-3.2.4/lib/src/flutter_typeahead.dart:936:9: Error: No named parameter with the name 'maxLengthEnforced'.
maxLengthEnforced: widget.textFieldConfiguration.maxLengthEnforced,
^^^^^^^^^^^^^^^^^
/C:/Flutter/flutter/packages/flutter/lib/src/material/text_field.dart:277:9: Context: Found this candidate, but the arguments don't match.
const TextField({
^^^^^^^^^
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:compileFlutterBuildProdDebug'.
> 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 8s
Exception: Gradle task assembleDebug failed with exit code 1
This almost looks like a package is missing but from my version of Flutter. I've tried cache repair, deleting build files, and upgrading Flutter. I have yet to find a solution.
Edit: I have run flutter doctor -v and gotten it to the point where it sees no issues. The problem persists. I've double checked project and flutter paths and nothing along those lines seems to be the hold up.
Edit: I created a test Flutter project and that ran fine so this has to do with this project specifically.
CodePudding user response:
The issue was that I had initially built the project with an older version of Flutter. When I migrated to a new machine, I installed a newer version and some of the dependencies didn't jive.
The solution was to upgrade the packages that were shown in the build error so they would work with the newer version of Flutter.