Creation failed with Flutter code Obfuscating - flutter

I am following this guide: https://flutter.dev/docs/deployment/obfuscate
Running Flutter 1.17.5 • channel stable
When I run:
flutter build apk --obfuscate --split-debug-info=/sample/debug --target-platform android-arm,android-arm64,android-x64
Then I get the following error:
Target android_aot_release_android-arm failed: FileSystemException: Creation failed, path =
'/sample' (OS Error: Read-only file system, errno = 30)
Target android_aot_release_android-x64 failed: FileSystemException: Creation failed, path =
'/sample' (OS Error: Read-only file system, errno = 30)
Target android_aot_release_android-arm64 failed: FileSystemException: Creation failed, path =
'/sample' (OS Error: Read-only file system, errno = 30)
build failed.
FAILURE: Build failed with an exception.
* Where:
Script '/Users/user/Developer/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 882
* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command '/Users/user/Developer/flutter/bin/flutter'' 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

You should provide a relative path from your root:
flutter build apk --obfuscate --split-debug-info=./sample/debug

Related

Error FAILURE: Build failed with an exception when running flutter emulator

I am getting error like this while running flutter with emulator in vscode. I have downloaded sdk and downloaded pixel api 30, how to solved it and I can run my code with emulator andoid?
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\Denis\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1005
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Users\Denis\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 32s
Exception: Gradle task assembleDebug failed with exit code 1

How to solve "Type 'GenerateAppTitle' not found"?

I would like to start a Flutter counter app. So I prepared all and started the flutter counter project.
Then I got this error:
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
../../../../../flutter/packages/flutter/lib/src/material/app.dart:365:9: Error: Type 'GenerateAppTitle' not found.
final GenerateAppTitle? onGenerateTitle;
^^^^^^^^^^^^^^^^
../../../../../flutter/packages/flutter/lib/src/cupertino/app.dart:292:9: Error: Type 'GenerateAppTitle' not found.
final GenerateAppTitle? onGenerateTitle;
^^^^^^^^^^^^^^^^
../../../../../flutter/packages/flutter/lib/src/material/app.dart:365:9: Error: 'GenerateAppTitle' isn't a type.
final GenerateAppTitle? onGenerateTitle;
^^^^^^^^^^^^^^^^
../../../../../flutter/packages/flutter/lib/src/cupertino/app.dart:292:9: Error: 'GenerateAppTitle' isn't a type.
final GenerateAppTitle? onGenerateTitle;
^^^^^^^^^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\{mywindowsname}\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1156
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Users\{mywindowsname}\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 20s
Exception: Gradle task assembleDebug failed with exit code 1
I already tried everything within the following error question on "Execution failed for task ':app:compileFlutterBuildDebug'." error message until Jakub S. answer to remove .gradle folder.
how to solve Execution failed for task ':app:compileFlutterBuildDebug'
Currently I think the problem is with the '"GenerateAppTitle" not found' message.
I tried the counter app on VS Code and Android Studio.
Nothing worked. What could the solution be?

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

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

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.

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"