Flutter : Gradle task assembleDebug failed with exit code 1 - flutter

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.

Related

I get this error i get after upgrading flutter to the latest version

I get this error after upgrading flutter. please how can i fix it.
Launching lib\main.dart on Android SDK built for x86 in debug mode... Exception in thread "main" java.util.zip.ZipException: zip END header not found at java.base/java.util.zip.ZipFile$Source.zerror(ZipFile.java:1607) at java.base/java.util.zip.ZipFile$Source.findEND(ZipFile.java:1497) at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1504) at java.base/java.util.zip.ZipFile$Source.(ZipFile.java:1308) at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1271) at java.base/java.util.zip.ZipFile$CleanableResource.(ZipFile.java:733) at java.base/java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:850) at java.base/java.util.zip.ZipFile.(ZipFile.java:248) at java.base/java.util.zip.ZipFile.(ZipFile.java:177) at java.base/java.util.zip.ZipFile.(ZipFile.java:191) at org.gradle.wrapper.Install.unzip(Install.java:214) at org.gradle.wrapper.Install.access$600(Install.java:27) at org.gradle.wrapper.Install$1.call(Install.java:74) 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 1 Exited (sigterm)
if you're using Windows, Go to the root directory C:\Users\YourUser and locate the hidden .gradle folder and delete it.
and then run your app connected to an Android emulator or device, don't cancel and make have a stable internet connection, this will download fresh Gradle
If the problem persists, Can you please provide your flutter doctor -v and flutter run --verbose logs, and a minimal complete reproducible code sample

i am facing issue while building my projects which were created o previous version and now in 2.8.0 these are not working

[!] Gradle threw an error while downloading artifacts from the network. Retrying to download...
Exception: Gradle task assembleDebug failed with exit code 1strong text

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 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 : How to fix 'Gradle task assembleDebug failed with exit code -1'?

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