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.
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.
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.
- Open your flutter Project directory.
- Change directory to android directory in your flutter project directory
- clean gradle
- Build gradle
./gradlew buildor you can combine both commands with just
./gradlew clean build(Thanks @daniel for the tip)
- Now run your flutter project. If you use vscode, press F5. First time gradle running assembleDebug will take time.
This Solution Worked For Me.
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.
- Interrupt gradle build
- Download the required gradle zip from a fast mirror: https://distfiles.macports.org/gradle/gradle-5.6.2-all.zip
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)
- that’s it.
There were two reasons for me on Archlinux:
- I needed to
unset TERMwhich was set to
- 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).
If you are on Windows: try adding firewall exceptions to your Android Studio.
- Go to: Control Panel\System and Security\Windows Defender Firewall\Allowed apps
- Hit the button: Allow another app
- Add your new firewall exceptions:studio.exe and studio64.exe
I hope this can be useful for you too.
If Running Gradle task assembledebug is taking unexpectedly long time, try updating Gradle in your project. Just Follow Below Steps.
- Open a project in Android Studio
- Right-click on android in Projects Panel
- Go down to Flutter and click on the ‘Open Android module in Android Studio’.
- Now, click on ‘gradle’ in the right panel.
- Next, click on ‘Execute Gradle Task’ icon.
- Now, Run the command
- and, then run
- 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.