Flutter Cannot Compile Due to Source Code Error [duplicate] - android

This question already has answers here:
flutter run -> Error: No named parameter with the name 'keyboardDismissBehavior'
(4 answers)
Closed 2 years ago.
When I try to run the app on the emulator I get this error saying there is something wrong with the... Flutter source code I guess... I tried pub get and pub upgrade, uninstalling the plugins and installing them again, deleting the Flutter files and extracting them again but nothing worked. Thank you!
/C:/src/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/pull_to_refresh-1.6.4/lib/src/smart_refresher.dart:434:9: Error: No named parameter with the name 'keyboardDismissBehavior'.
keyboardDismissBehavior:
^^^^^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/flutter/packages/flutter/lib/src/widgets/scroll_view.dart:588:9: Context: Found this candidate, but the arguments don't match.
const CustomScrollView({
^^^^^^^^^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'C:\src\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 904
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\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 33s
Exception: Gradle task assembleDebug failed with exit code 1

I think the problem may be in your version of Flutter. Please try and run flutter doctor -v.
If it works, then add the result in the question and we will be able to find the error.
If it doesn't work, then try reinstalling your flutter.

You can run :
flutter clean
flutter pub get

Related

When I try to implement the project it fails, and I get this error [duplicate]

This question already has answers here:
ERROR: JAVA_HOME is not set and no 'java' command could be found in your flutter PATH. In Flutter
(15 answers)
Closed last month.
All of the Extras is an upgrade, and when I make run build the project, it gives me this error:
FAILURE: Build failed with an exception.
* What went wrong:
The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:\Program Files\java\jdk-19\bin\java.exe
* 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
Exception: Gradle task assembleDebug failed with exit code 1
I am using Visual Studio Code and the emulator by Android Studio.
Don't add java.exe in your environmental variable path. End it with bin.
For example, 'C:\Program Files\java\jdk-19\bin'. That's it.

Codepoint 984652 not found in font Flutter

Building with sound null safety
Codepoint 984652 not found in font, aborting.
FAILURE: Build failed with an exception.
Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1102
What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
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 41s
Running Gradle task 'assembleRelease'... 46.1s
Gradle task assembleRelease failed with exit code 1
try building your application with this flutter build apk --no-tree-shake-icons
There is an issue with icons in Flutter 2.10.0 which causes this error. I am assuming that you are using 2.10.0 version of Flutter.
This issue is resolved in Flutter 2.10.2. So, run Flutter upgrade in the terminal to solve the problem.

How to resolve Gradle task assembleDebug failed with exit code 1 in my first flutter app?

I recently come from java and try to make my first app in flutter in android studio in windows 10.
I tried first sample code in my real android device and got this error.
I cant find proper after struggling 5 hours
In console get this error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:stripDebugDebugSymbols'.
> NDK at C:\Users\10\AppData\Local\Android\sdk\ndk-bundle did not have a source.properties file
* 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 1s
Exception: Gradle task assembleDebug failed with exit code 1
Looks like you are missing NDK installation. Please confirm if highlighted item is installed

Error comes when I run my app on android studio cloned from git hub

I cloned an app from a git hub repo and when I ran it on my system, it shows this error.
/C:/src/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.19.3/lib/src/picture_provider.dart:56:45: Error: Method not found: 'Localizations.maybeLocaleOf'.
locale: context != null ? Localizations.maybeLocaleOf(context) : null,
^^^^^^^^^^^^^
/C:/src/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.19.3/lib/src/picture_provider.dart:57:53: Error: Method not found: 'Directionality.maybeOf'.
textDirection: context != null ? Directionality.maybeOf(context) : null,
^^^^^^^
FAILURE: Build failed with an exception.
*Where
Script 'C:\src\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 904
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\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.
Here is the snap of the flutter doctor -v
Flutter doctor console snapshot
It keeps showing this error that flutter and dart plugins are not installed. If you could also provide a solution to that or is it that there is some issue with the latest version of flutter?
Please if someone could help!
The error in flutter doctor is normal, everything works despite those two errors.
Did you run flutter pub get after cloning your project?
The error is also specifically telling you to go to the file: 'lib/src/picture_provider.dart'
then go to line #57 and in column 53 there is that error. It might be an outdated package or something incompatible with null-safety.
take a look at this similar question.

Flutter build failed in ubuntu 19.10

I have a flutter apps which is building perfectly in another machine(ubuntu 18.04). Now I am using ubuntu 19.10 , when I tried to run this apps using flutter run command, its throws these errors:
Launching lib/main.dart on Primo EF6 in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
Cannot create service of type PayloadSerializer using ToolingBuildSessionScopeServices.createPayloadSerializer() as there is a problem with parameter #2 of type PayloadClassLoaderFactory.
> Cannot create service of type PayloadClassLoaderFactory using ToolingBuildSessionScopeServices.createClassLoaderFactory() as there is a problem with parameter #1 of type CachedClasspathTransformer.
* 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 4s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 5.5s
Gradle task assembleDebug failed with exit code 1
I think it is gradle issue. I am using flutter v1.12.13+hotfix.6
Fixed this problem. There was a permission issue on .gradle directory, it was readonly . So changing permission solves this issue.

Categories

Resources