[Solved] Flutter App stuck at “Running Gradle task ‘assembleDebug’… ”

Hello Guys, how are you all? Hope you all are fine. You might face [Solved] Flutter App stuck at “Running Gradle task ‘assembleDebug’… ” this error in a flutter. here I come with all possible solutions for this error.

we are providing you all possible solutions to solve this error. let’s start this article without wasting your time.

How Flutter App stuck at “Running Gradle task ‘assembleDebug’… ” Cause ?

You Might Face This Problem. When I run the app it get stuck

Launching lib\main.dart on Lenovo A319 in debug mode...
Running Gradle task 'assembleDebug'...
(This is taking an unexpectedly long time.)

It never initialize Gradle nor the dependencies. Here is I am Adding All Possible solutions that I have tried to Solve This Error.


How To Solve Flutter App Stuck at “Running Gradle task ‘assembleDebug’…” ?

Sometimes Its This Error Cause Sometimes in the background flutter downloading gradles files and this was going to take hours. That’s why the app can be stuck.

Solution 1

Sometimes Its This Error Cause of Sometimes in background flutter downloading gradles files and this was going to take hours. That’s why app can stuck.

  1. Open your flutter Project directory.
  2. Change directory to android directory in your flutter project directory cd android
  3. clean gradle ./gradlew clean
  4. Build gradle ./gradlew build or you can combine both commands with just ./gradlew clean build (Thanks @daniel for the tip)
  5. Now run your flutter project. If you use vscode, press F5. First time gradle running assembleDebug will take time.

This Solution Worked For Me.

Solution 2

When I Try to see Log flutter run -v showed that I was stuck on Downloading https://services.gradle.org/distributions/gradle-5.6.2-all.zip. This Process Can take Hours. To solve this error you have to follow the below steps.

  1. Interrupt gradle build
  2. Download the required gradle zip from a fast mirror: https://distfiles.macports.org/gradle/gradle-5.6.2-all.zip
  3. Copy gradle-5.6.2-all.zip to C:\Users\ <MyUsername>\.gradle\wrapper\dists\gradle-5.6.2-all\9st6wgf78h16so49nn74lgtbb (of course the last folder will have a different name on your PC)
  4. flutter run.
  5. that’s it.

Solution 3

There were two reasons for me on Archlinux:

  1. I needed to unset TERM which was set to xterm-256color (reference).
  2. For some reason, flutter stable was not working for me; so I switched to master with: flutter channel master && flutter upgrade. I’ll be able to switch back to flutter stable when the fix in master makes its way into stable (reference).

Solution 4

If you are on Windows: try adding firewall exceptions to your Android Studio.

  1. Go to: Control Panel\System and Security\Windows Defender Firewall\Allowed apps
  2. Hit the button: Allow another app
  3. Add your new firewall exceptions:studio.exe and studio64.exe

I hope this can be useful for you too.

Solution 5

If Running Gradle task assembledebug is taking unexpectedly long time, try updating Gradle in your project. Just Follow Below Steps.

  1. Open a project in Android Studio
  2. Right-click on android in Projects Panel
  3. Go down to Flutter and click on the ‘Open Android module in Android Studio’.
  4. Now, click on ‘gradle’ in the right panel.
  5. Next, click on ‘Execute Gradle Task’ icon.
  6. Now, Run the command gradlew clean
  7. and, then run gradlew build
  8. If prompted by Android Studio to ‘Update Gradle Plugin’, do that.

The update would download the required .zip files. And, your apps should work fine after that.


So it’s all About All possible solutions. Hope this above all solution helped you a lot. Comment below Your thoughts and your queries. Comment Below on your suggestion.

Also Read

Milan Dhameliya is an Information Technology Engineer. By profession, he is a Full Stack developer with knowledge of multiple back-end platforms (e.g., PHP, Node.js, Python) and frontend Flutter frameworks.

Leave a Comment