unable to locate asset entry in pubspec.yaml: "fonts/Signatra.ttf" - flutter

Can anyone can help me with this problem?
Error: unable to locate asset entry in pubspec.yaml:
"fonts/Signatra.ttf".
FAILURE: Build failed with an exception.
* Where: Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1005
* 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 5s Exception: Gradle task assembleDebug failed with
exit code 1

Please check on the following pointers and fix your path in pubspec.ymal accordingly:
The assets folder should be in the root path (/). If you want to keep it in the lib folder, put lib in front of assets like this:
`lib/assets/fonts/Signatra.ttf`
If you want to keep it in the asset folder:
`assets/fonts/Signatra.ttf`
PS: please check the name of file and the name which you are entering in pubspec.ymal also.

Related

Getting an error white running flutter application "FAILURE: build failed with an exception"

I am getting an error while running my flutter application through vscode the error "FAILURE: build failed with an exception"
I attach the full error below.
Since I am new to this environment I don't know about this, please help me, Thank you!
FAILURE: Build failed with an exception.
* Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1256
* What went wrong:
Could not determine the dependencies of task ':app:compileFlutterBuildDebug'.
> Index 1 out of bounds for length 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 18s
Exception: Gradle task assembleDebug failed with exit code 1

FAILURE: Build failed with an exception.I get this error

I went through all the threads but couldn't solve the problem. I keep getting this error every time I run the project.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':barcode_scan2:generateDebugProto'.
protoc: stdout: . stderr: D:\Yeni klasor\flutter.pub-cache\hosted\pub.dartlang.org\barcode_scan2-4.2.1\protos: warning: directory does not exist.
Could not make proto path relative: D:\Yeni klasor\flutter.pub-cache\hosted\pub.dartlang.org\barcode_scan2-4.2.1\protos\android_configuration.proto: No such file or directory
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

Error incorrect settings while building a flutter project

i work on windows and i get this error while running a flutter project , so it work on chrome but on the real device phone or emulator it does not .
this the error :
Format incorrect du param�tre -
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':shared_preferences_android:parseDebugLocalResources'.
> Could not resolve all files for configuration ':shared_preferences_android:androidApis'.
> Failed to transform android.jar to match attributes {artifactType=android-platform-attr, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for PlatformAttrTransform: C:\Users\MEJDI BEN HAMIDA\AppData\Local\Android\sdk\platforms\android-31\android.jar.
> zip END header not found
* 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 7s
Running Gradle task 'assembleDebug'... 8,9s
Exception: Gradle task assembleDebug failed with exit code 1

Flutter Build failed with an exception in Gradle

Since a couple of days, my code is no longer working but I don't know what I have changed and no solution on the internet worked for me so far.
Stackoverflow doesn't allow me to fill in the whole issue log because of spam but in the end it says:
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: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 15s
Exception: Gradle task assembleDebug failed with exit code 1
You can also find my whole code here: https://github.com/Burekmasta/BlogApp
Flutter doctor

Why do I get "FAILURE: Build failed with an exception."?

When I try to start my app I get an error. I think I get the error because I tried to add a video in my app, because before I did this everything worked without an error.
This is the error:
Launching lib\main.dart on SM J530F in debug mode...
Running Gradle task 'assembleDebug'...
Target debug_android_application failed: FileSystemException: Cannot copy file to 'C:\Users\Simon\Desktop\App Entwickeln\Projekte\trainings_app\build\app\intermediates\flutter\debug\flutter_assets\assets/coffee.mp4', path = 'C:\Users\Simon\Desktop\App Entwickeln\Projekte\trainings_app\assets\coffee.mp4' (OS Error: Zugriff verweigert
, errno = 5)
build failed.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\Simon\Desktop\App Entwickeln\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 882
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Users\Simon\Desktop\App Entwickeln\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 26s
Exception: Gradle task assembleDebug failed with exit code 1
Try flutter clean then build again
That looks like a file permissions related issue. Do you get error when you try below code in command line? If you have you need to check permission of the path you gave.
copy "C:\Users\Simon\Desktop\App Entwickeln\Projekte\trainings_app\assets\coffee.mp4" "C:\Users\Simon\Desktop\App Entwickeln\Projekte\trainings_app\build\app\intermediates\flutter\debug\flutter_assets\assets/coffee.mp4"