Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1035 - flutter

debug console looke like this :
FAILURE: Build failed with an exception.
Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1035
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1
if anyone knows how to solve it plz answer me

I was facing the same issue it's generally related to flutter installation and your java environment if it's any of those you have to completely reinstall flutter and also your Android Studio. If this is the first time you running flutter on your desktop then this might be the problem.
But there are some more quick fixes to try out before taking the above measure
Like clearing out cache and stuff or if there's a problem with the minimum SDK version try exporting the code to a new flutter app or updating/downgrading SDK version.

Related

A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction

I am getting this while trying to run build in debug mode
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
> java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
I already ran flutter clean then flutter pub get before launching the app again. It still not going!
The flutter doctor command result is OK and fine too
Try this solution by adding this line to gradle.properties.
org.gradle.jvmargs=-Xmx4608m
It finally worked!
I solved the problem by adding adding org.gradle.jvmargs=-Xmx4608m in the gradle.properties file and deleting the./gradle/cahes directly ✔️

Upgrading to flutter 3.0

I am severely getting error:
FAILURE: Build failed with an exception.
Where:
Script '~\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1156
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
'~/flutter\bin\flutter.bat' finished with non-zero exit value 1
Currently I am using flutter 2.10.4. Waiting to upgrade with newer version but unfortunately gone few days because of work.
Tried deleting cache and build files. Clean and rebuild the project, nothing works.
Any help would be a great support!

FAILURE: Build failed with an exception. flutter.gradle' line: 904

FAILURE: Build failed with an exception.
Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 904
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1
I tried flutter clean / pug get and update but application is still not working.
Try this:
flutter clean
flutter pub get
Once these two commands have been successfully executed, launch your project ... This is what I did and it worked.
try running
flutter clean
flutter upgrade
it work for me.
In Android Studio I did the following:
flutter clean
flutter pub get
Invalidate Caches and Restart (from the File menu)
After all that, I re-ran the flutter build appbundle command and it worked.
My antivirus was blocking dart from reading asset images, i allowed it from there and the error got fixed!!
I've had the same error and tried the following:
uninstall android studio and delete all folders regarding this
clean up registry
review path for environment variables
give all sorts of flutter commands (clean, update, and so on)
Until I realized this is an error on the flutter folder, so basically this is due to some force close some operations and the variables that write in the 'flutter.gradle' file are obsolete. What I did and worked for me:
Make sure you have all android studio processes closed.
Delete the flutter folder (the one that you defined as for the PATH)
Extract in the same location the flutter folder from the SDK archive.
Enjoy :)
Powershell commands Example:
Remove-Item 'D:\DEV\flutter'
Expand-Archive -LiteralPath 'C:\Archives\flutter_windows_1.22.3-stable.Zip' -DestinationPath D:\DEV

Build failed - flutter.gradle

Flutter run produces the following error:
Target debug_android_application failed: Exception: Failed to bundle asset files.
build failed.
FAILURE: Build failed with an exception.
Where:
Script '/Users/kirk/Developer/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 896
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command '/Users/kirk/Developer/flutter/bin/flutter'' finished with non-zero exit value 1
Any potential solutions on how to fix this?
i think that you have compatibility issues between the build tools located in android/build.gradle and the gradle located in android/gradle/wrapper/gradle-wrapper.properties, try upgrade or downgrade one of them to be compatible with the other, check this table for compatibilites: https://developer.android.com/studio/releases/gradle-plugincompatibilites
I had exactly the same problem where I couldn't compile or debug my Flutter app. To solve this, just go to tools and in Flutter selection, click on {open project for editing in Android Studio}. This will open only the Android counterpart and you will be able to update your gradle dependencies once the analysis is finished.
I have face similar issues so after spending lot of time i have found if we can write full path for assests file then it works please check below example how it is defined.
assets:
- assets/bg_screen_page.png
- assets/logo.png

Ionic Android Build Error

I'm seeing these errors after fresh ionic, cordova, and JDK update installations when I do android build:
BUILD FAILED
Total time: 6.254 secs
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':processDebugResources'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'c:\Android\sdk\build-tools\24.0.2\aapt.exe'' 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.
Error: cmd: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':processDebugResources'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'c:\Android\sdk\build-tools\24.0.2\aapt.exe'' finished with non-zero exit value 1
You have to update to JDK 8. Looks like you have the older version 7.
Try JDK 8
and see if it helps.
I had the same problem reinstalled SDK didn't work
removed old sdk and reinstalled SDK did't work
You need to delete the android folder form the platform folder and execute
ionic run android this will reinstall the platform automatically and build from scratch. I think the cache files are the problem so that is why I think this worked.
I hope it will also work for others.