Flutter : How to fix 'Gradle task assembleDebug failed with exit code -1'? - flutter

I just started using flutter on vscode and the Android emulator is connected to vscode. when I run the first flutter code by pressing f5 is not running, and on the console it says:
Launching lib\main.dart on Samsung in debug mode...
Gradle task assembleDebug failed with exit code -1
Exited (sigterm)
when I run it using intellij sometimes it works and sometimes it fails like the problem above. how do you solve the problem with vscode? intellij is too heavy for my computer.

This is a grade problem, and could be hard for you to debug without getting sufficient info on the problem
cd into your android directory
then
run ./gradlew build
you should be able to get the cause of the failed build

Related

Flutter : Gradle task assembleDebug failed with exit code 1

Launching lib/main.dart on SM A715F in debug mode...Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=trueException in thread "main" java.net.UnknownHostException: DESKTOP-O8L0ETS 9204at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:220)at java.base/java.net.Socket.connect(Socket.java:609)at java.base/java.net.Socket.connect(Socket.java:558)at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:182)at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:474)at java.base/sun.net.www.http.HttpClient$1.run(HttpClient.java:526)at java.base/sun.net.www.http.HttpClient$1.run(HttpClient.java:524)at java.base/java.security.AccessController.doPrivileged(Native Method)at java.base/sun.net.www.http.HttpClient.privilegedOpenServer(HttpClient.java:523)at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:564)at java.base/sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:265)at java.base/sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:372)at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:212)at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1208)at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1081)at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:189)at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1592)at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:250)at org.gradle.wrapper.Download.downloadInternal(Download.java:58)at org.gradle.wrapper.Download.download(Download.java:44)at org.gradle.wrapper.Install$1.call(Install.java:61)at org.gradle.wrapper.Install$1.call(Install.java:48)at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)at org.gradle.wrapper.Install.createDist(Install.java:48)at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)Exception: Gradle task assembleDebug failed with exit code 1Exited (sigterm)
I am a student.
I am trying to run this app created by flutter but I get this error. I disabled all Java options yesterday thinking that was the problem
I am running on flutter version 2.10.3, dart version 2.16.1.
Try upgrading gradle version and the run "flutter clean" command in terminal and then try to build the project.

Flutter Project Launch Issue with VsCode

I use my phone as an emulator while developing applications with Flutter.
After updating to the Flutter 2 version, Web Folder added to Flutter file directory, I know that.
but i can't run the project
Here I started the classic flutter counter app and the result:
Launching lib\main.dart on MI 5 in debug mode...
lib\main.dart:1
Exception: Gradle task assembleDebug failed with exit code -1
Exited (sigterm)
I searched for a solution on the internet but could not solve this stupid error
how can i solve this problem?
Connect to Internet
run flutter clean
then flutter pub get
then flutter run .
This might help, try it out.
This error usually comes when some files are pending download or so.
if I use flutter run command from terminal
Launching lib\main.dart on MI 5 in debug mode...
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 76,3s
Exception: Gradle task assembleDebug failed with exit code -1
I'm not sure but,
Try changing minSdkVersion from 16 to 21
You can find this property in ./android/app/build.gradle
Then do a flutter clean and run the project
If this does not work there might be issue with the emulator or the flutter version.

Flutter App stuck at “Running Gradle task 'assembleDebug'… ”

Please I need Help Solving this Issue
I have been running my flutter app without issues, but recently I can't run or debug my apps again, each time I try running my app from the terminal or debug console it always get stuck at Flutter App stuck at “Running Gradle task 'assembleDebug'”
C:\Development\projects\flutter>cd kchat
C:\Development\projects\flutter\Kchat>flutter run
Running "flutter pub get" in Kchat... 3.6s
Launching lib\main.dart on GIONEE S10C in debug mode...
Running Gradle task 'assembleDebug'...
(This is taking an unexpectedly long time.)
I have solved the problem by running
flutter run -v
it fixed all the problem but took a longer time, and I can now use
flutter run
but still can't use Debug console
Alternatively, try to fix your project.
Delete the android folder in your project, having previously saved it in another place, then in the terminal run flutter create your_project_name for the folder in which your project is located.

Flutter get error "Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain"

I'm trying to run my project , I am getting error
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Exception: Gradle task assembleDebug failed with exit code 1
It is hard to know the problem with so little information. One general approach with worked to me was performing:
flutter clean
Try to run.
If it does not run delete the jar file under android/gradle/properties to recompile it and try again.

Flutter Wrong full snapshot version

I was using Flutter and it was okay, until I run the -flutter upgrade. After that, when I put in debug mode, even when the emulator is already on, debug console shows this message:
Wrong full snapshot version, expected '0c73eb70aa4d30f450273cb424be8c62' found '1d7acad1540192ac459cf60344efb7c1'
Isolate creation failed
Compiler failed on C:\Users\myname\Documents\projetos\16Apps\projeto4\lib\main.dart
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
When I try -flutter doctor, it says that no issues was found.
There is a similar issue reported here at
https://github.com/flutter/flutter/issues/16103
try to use
git clean -xffd